diff options
author | Victor Shyba <victor.shyba@gmail.com> | 2016-08-22 18:00:52 -0300 |
---|---|---|
committer | Victor Shyba <victor.shyba@gmail.com> | 2016-08-22 18:49:18 -0300 |
commit | 4f5ecb4c719a3a842d852fbaab549d2881d6528f (patch) | |
tree | dcf6698e8556f09de0f54ec925ce760a58693a70 /testing | |
parent | cf91133809bab11ee43f20178944f91b1466bfd5 (diff) |
[test] make txbench ignore kwargs for readability
They arent used so far and using empty dicts to make them work is ugly.
Removing it leaves the return function on setup code clean and readable.
Diffstat (limited to 'testing')
-rw-r--r-- | testing/tests/perf/conftest.py | 6 | ||||
-rw-r--r-- | testing/tests/perf/test_encdecpool.py | 4 | ||||
-rw-r--r-- | testing/tests/perf/test_sync.py | 6 |
3 files changed, 9 insertions, 7 deletions
diff --git a/testing/tests/perf/conftest.py b/testing/tests/perf/conftest.py index fca9c58d..68e0fb38 100644 --- a/testing/tests/perf/conftest.py +++ b/testing/tests/perf/conftest.py @@ -193,7 +193,11 @@ def txbenchmark_with_setup(benchmark): return threads.blockingCallFromThread(reactor, f, *args, **kwargs) def blocking_setup(): - return threads.blockingCallFromThread(reactor, setup) + args = threads.blockingCallFromThread(reactor, setup) + try: + return tuple(arg for arg in args), {} + except TypeError: + return ((args,), {}) if args else None def bench(): return benchmark.pedantic(blocking_runner, setup=blocking_setup, diff --git a/testing/tests/perf/test_encdecpool.py b/testing/tests/perf/test_encdecpool.py index 681b909a..4eb990a8 100644 --- a/testing/tests/perf/test_encdecpool.py +++ b/testing/tests/perf/test_encdecpool.py @@ -18,7 +18,7 @@ def create_encrypt(amount, size): pool = SyncEncrypterPool(client._crypto, client._sync_db) pool.start() request.addfinalizer(pool.stop) - return (pool,), {} + return pool @pytest.inlineCallbacks def put_and_wait(pool): @@ -63,7 +63,7 @@ def create_decrypt(amount, size): json=json.dumps(DOC_CONTENT)) encrypted_content = json.loads(crypto.encrypt_doc(doc)) docs.append((doc.doc_id, encrypted_content)) - return (pool, docs), {} + return pool, docs def put_and_wait(pool, docs): deferreds = [] # fires on completion diff --git a/testing/tests/perf/test_sync.py b/testing/tests/perf/test_sync.py index 668ceae7..0be9d12f 100644 --- a/testing/tests/perf/test_sync.py +++ b/testing/tests/perf/test_sync.py @@ -45,8 +45,7 @@ def create_download(downloads, size): # ensures we are dealing with properly encrypted docs def setup(): - clean_client = soledad_client() - return (clean_client,), {} + return soledad_client() def sync(clean_client): return clean_client.sync() @@ -63,8 +62,7 @@ test_download_1000_10k = create_download(1000, 10*1000) @pytest.mark.benchmark(group="test_nothing_to_sync") def test_nothing_to_sync(soledad_client, txbenchmark_with_setup): def setup(): - clean_client = soledad_client() - return (clean_client,), {} + return soledad_client() def sync(clean_client): return clean_client.sync() |