Skip to content

Commit

Permalink
Revert "Drop callertype fixture from benchmark tests"
Browse files Browse the repository at this point in the history
This reverts commit 72948af since we
need this parametrization for testing the cythonized version of
`_multicall` aka `pluggy.caller.cythonized._c_multicall()`.
  • Loading branch information
goodboy committed Jun 4, 2020
1 parent b6c2230 commit d6994e1
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions testing/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
hookimpl = HookimplMarker("example")


def MC(methods, kwargs, firstresult=False):
def MC(methods, kwargs, callertype, firstresult=False):
hookfuncs = []
for method in methods:
f = HookImpl(None, "<temp>", method, method.example_impl)
hookfuncs.append(f)
return _multicall(hookfuncs, kwargs, firstresult=firstresult)
return callertype(hookfuncs, kwargs, firstresult=firstresult)


@hookimpl
Expand All @@ -38,9 +38,14 @@ def wrappers(request):
return [wrapper for i in range(request.param)]


def inner_exec(methods):
return MC(methods, {"arg1": 1, "arg2": 2, "arg3": 3})
@pytest.fixture(params=[_multicall], ids=lambda item: item.__name__)
def callertype(request):
return request.param


def test_hook_and_wrappers_speed(benchmark, hooks, wrappers):
benchmark(inner_exec, hooks + wrappers)
def inner_exec(methods, callertype):
return MC(methods, {"arg1": 1, "arg2": 2, "arg3": 3}, callertype)


def test_hook_and_wrappers_speed(benchmark, hooks, wrappers, callertype):
benchmark(inner_exec, hooks + wrappers, callertype)

0 comments on commit d6994e1

Please sign in to comment.