Skip to content

Commit

Permalink
Don't use the deprecated __multicall__ anymore.
Browse files Browse the repository at this point in the history
  • Loading branch information
ionelmc committed Oct 17, 2015
1 parent c818d01 commit ea3c26d
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/pytest_benchmark/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import operator

import py
import pytest

import pytest
from . import __version__
from .compat import INT
from .compat import XRANGE
Expand Down Expand Up @@ -841,20 +841,26 @@ def pytest_benchmark_compare_machine_info(config, benchmarksession, machine_info
)
)

if hasattr(pytest, 'hookimpl'):
_hookwrapper = pytest.hookimpl(hookwrapper=True)
else:
_hookwrapper = pytest.mark.hookwrapper


def pytest_runtest_call(item, __multicall__):
@_hookwrapper
def pytest_runtest_call(item):
bs = item.config._benchmarksession
fixure = hasattr(item, "funcargs") and item.funcargs.get("benchmark")
if isinstance(fixure, BenchmarkFixture):
if bs.skip:
pytest.skip("Skipping benchmark (--benchmark-skip active).")
else:
__multicall__.execute()
yield
else:
if bs.only:
pytest.skip("Skipping non-benchmark (--benchmark-only active).")
else:
__multicall__.execute()
yield


def pytest_benchmark_group_stats(config, benchmarks, group_by):
Expand Down

0 comments on commit ea3c26d

Please sign in to comment.