summaryrefslogtreecommitdiff
path: root/testing/tests/benchmarks
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2017-07-12 12:27:38 -0300
committerdrebs <drebs@leap.se>2017-07-12 12:29:21 -0300
commitbd10a5c16cd0d755b6b74389462b0c15e2dcc15e (patch)
treef8d259b2ab9e09a8892e689691a6e43b947a3604 /testing/tests/benchmarks
parent95c65e5449c5a33d743548b968e0b513b9d48129 (diff)
[benchmarks] allow passing args and kwargs to txbenchmark_with_setup
Diffstat (limited to 'testing/tests/benchmarks')
-rw-r--r--testing/tests/benchmarks/conftest.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/testing/tests/benchmarks/conftest.py b/testing/tests/benchmarks/conftest.py
index 3be17083..e31f98c4 100644
--- a/testing/tests/benchmarks/conftest.py
+++ b/testing/tests/benchmarks/conftest.py
@@ -57,7 +57,7 @@ def txbenchmark(monitored_benchmark):
@pytest.fixture()
def txbenchmark_with_setup(monitored_benchmark_with_setup):
- def blockOnThreadWithSetup(setup, f):
+ def blockOnThreadWithSetup(setup, f, *args, **kwargs):
def blocking_runner(*args, **kwargs):
return threads.blockingCallFromThread(reactor, f, *args, **kwargs)
@@ -71,7 +71,8 @@ def txbenchmark_with_setup(monitored_benchmark_with_setup):
def bench():
return monitored_benchmark_with_setup(
blocking_runner, setup=blocking_setup,
- rounds=4, warmup_rounds=1)
+ rounds=4, warmup_rounds=1, iterations=1,
+ args=args, kwargs=kwargs)
return threads.deferToThread(bench)
return blockOnThreadWithSetup
@@ -153,6 +154,7 @@ def monitored_benchmark(benchmark, request):
@pytest.fixture
-def monitored_benchmark_with_setup(benchmark, request):
+def monitored_benchmark_with_setup(benchmark, request, *args, **kwargs):
return functools.partial(
- _monitored_benchmark, benchmark, benchmark.pedantic, request)
+ _monitored_benchmark, benchmark, benchmark.pedantic, request,
+ *args, **kwargs)