def test_simple_cm():
with SQLJob("~/.mapepire-test.ini", section="ossbuild") as job:
with job.query("select * from sample.employee") as query:
result = query.run(rows_to_fetch=5)
testing
Create a .mapepire-test.ini file in your home directory (the name and location does not matter, just needs to accessible by current user)
[ossbuild]
HOST=x
USER=x
PASSWORD=x
PORT=x
create a test file _test_config_ini.py in the tests directory (this file will be ignored by git), then paste in following code to test:
from mapepire_python import connect
from mapepire_python.client.sql_job import SQLJob
def test_simple():
job = SQLJob()
_ = job.connect("~/.mapepire-test.ini", section="ossbuild")
query = job.query("select * from sample.employee")
result = query.run(rows_to_fetch=5)
job.close()
assert result["success"] is True
assert result["is_done"] is False
assert result["has_results"] is True
def test_simple_cm():
with SQLJob("~/.mapepire-test.ini", section="ossbuild") as job:
with job.query("select * from sample.employee") as query:
result = query.run(rows_to_fetch=5)
assert result["success"] is True
assert result["is_done"] is False
assert result["has_results"] is True
def test_pep249_cm_fetchmany_ini():
with connect("~/.mapepire-test.ini", section="ossbuild") as connection:
with connection.execute("select * from sample.employee") as cur:
res = cur.fetchmany(5)
assert len(res["data"]) == 5
Before submitting
[ ] Change the base branch to dev if it is not already.
[ ] I've read and followed all steps in the Making a pull request
section of the CONTRIBUTING docs.
[ ] I've updated or added any relevant docstrings following the syntax described in the
Writing docstrings section of the CONTRIBUTING docs.
[ ] If this PR fixes a bug, I've added a test that will fail without my fix.
[ ] If this PR adds a new feature, I've added tests that sufficiently cover my new functionality.
Fixes #
Changes proposed in this pull request:
testing
Create a
.mapepire-test.ini
file in your home directory (the name and location does not matter, just needs to accessible by current user)create a test file
_test_config_ini.py
in the tests directory (this file will be ignored by git), then paste in following code to test:Before submitting
dev
if it is not already.CONTRIBUTING
docs.CONTRIBUTING
docs.