summaryrefslogtreecommitdiff
path: root/testing/tests/perf/conftest.py
diff options
context:
space:
mode:
authorVictor Shyba <victor.shyba@gmail.com>2016-08-09 23:54:33 -0300
committerVictor Shyba <victor.shyba@gmail.com>2016-08-22 12:36:16 -0300
commit6639cf0d00fa5bdfc0f43d4dea5c5055776130b8 (patch)
treef8fd08ad84918e96cffdffd814e2a129ef705599 /testing/tests/perf/conftest.py
parentf0f3e0358a01708eb048d8eaf463361e682be466 (diff)
[test] use a nested func to simplify scenarios
If we have many scenarios (like 20/500k, 100/100k, 1000,10k) then making a nested function to generate tests based on scenario parameters simplifies the code a lot.
Diffstat (limited to 'testing/tests/perf/conftest.py')
-rw-r--r--testing/tests/perf/conftest.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/testing/tests/perf/conftest.py b/testing/tests/perf/conftest.py
index 8a75d0ae..4b2186db 100644
--- a/testing/tests/perf/conftest.py
+++ b/testing/tests/perf/conftest.py
@@ -208,7 +208,7 @@ def txbenchmark_with_setup(benchmark):
#
@pytest.fixture()
-def soledad_client(tmpdir, soledad_server, remote_db, soledad_dbs):
+def soledad_client(tmpdir, soledad_server, remote_db, soledad_dbs, request):
passphrase = DEFAULT_PASSPHRASE
server_url = DEFAULT_URL
token = DEFAULT_TOKEN
@@ -220,7 +220,7 @@ def soledad_client(tmpdir, soledad_server, remote_db, soledad_dbs):
local_db_path = os.path.join(tmpdir.strpath, '%s.db' % uuid4().hex)
remote_db(uuid)
soledad_dbs(uuid)
- return Soledad(
+ soledad_client = Soledad(
uuid,
unicode(passphrase),
secrets_path=secrets_path,
@@ -229,4 +229,6 @@ def soledad_client(tmpdir, soledad_server, remote_db, soledad_dbs):
cert_file=None,
auth_token=token,
defer_encryption=True)
+ request.addfinalizer(soledad_client.close)
+ return soledad_client
return create