From bd10a5c16cd0d755b6b74389462b0c15e2dcc15e Mon Sep 17 00:00:00 2001 From: drebs Date: Wed, 12 Jul 2017 12:27:38 -0300 Subject: [benchmarks] allow passing args and kwargs to txbenchmark_with_setup --- testing/tests/benchmarks/conftest.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'testing/tests/benchmarks') 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) -- cgit v1.2.3