summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Shyba <victor.shyba@gmail.com>2016-08-22 18:53:49 -0300
committerVictor Shyba <victor.shyba@gmail.com>2016-08-22 18:53:49 -0300
commitbad25ba9a5e7e5296b79544f50cafc47599a76b9 (patch)
tree2f7e45c062f96c4bbce878cc78b65b308b8700ba
parent71b13eda4ec5a577df1ccf4b07e26cbd87eaaa3e (diff)
[tests] move doc creation to setup
Otherwise it will add unrelated overhead to results.
-rw-r--r--testing/tests/perf/test_encdecpool.py19
1 files changed, 8 insertions, 11 deletions
diff --git a/testing/tests/perf/test_encdecpool.py b/testing/tests/perf/test_encdecpool.py
index 4eb990a8..919fdaa7 100644
--- a/testing/tests/perf/test_encdecpool.py
+++ b/testing/tests/perf/test_encdecpool.py
@@ -18,19 +18,16 @@ def create_encrypt(amount, size):
pool = SyncEncrypterPool(client._crypto, client._sync_db)
pool.start()
request.addfinalizer(pool.stop)
- return pool
+ docs = [
+ SoledadDocument(doc_id=uuid4().hex, rev='rev',
+ json=json.dumps(DOC_CONTENT))
+ for _ in xrange(amount)
+ ]
+ return pool, docs
@pytest.inlineCallbacks
- def put_and_wait(pool):
- doc_ids = []
- deferreds = []
- for _ in xrange(amount):
- doc = SoledadDocument(
- doc_id=uuid4().hex, rev='rev',
- json=json.dumps(DOC_CONTENT))
- deferreds.append(pool.encrypt_doc(doc))
- doc_ids.append(doc.doc_id)
- yield gatherResults(deferreds)
+ def put_and_wait(pool, docs):
+ yield gatherResults([pool.encrypt_doc(doc) for doc in docs])
yield txbenchmark_with_setup(setup, put_and_wait)
return test