File tree Expand file tree Collapse file tree 3 files changed +24
-6
lines changed Expand file tree Collapse file tree 3 files changed +24
-6
lines changed Original file line number Diff line number Diff line change 30
30
matrix :
31
31
config :
32
32
- headless
33
- - pytest-benchmark
33
+ - pytest-benchmark-4
34
+ - pytest-benchmark-5
34
35
- valgrind
35
36
python-version :
36
37
- " 3.9"
@@ -51,10 +52,15 @@ jobs:
51
52
name : Install valgrind
52
53
run : sudo apt-get install valgrind -y
53
54
- name : Install dependencies with pytest${{ matrix.pytest-version }}
54
- run : pip install .[dev,compat,build] "pytest${{ matrix.pytest-version }}"
55
- - if : matrix.config != 'pytest-benchmark'
56
- name : Uninstall pytest-benchmark
57
- run : pip uninstall -y pytest-benchmark
55
+ run : |
56
+ pip install .[dev,compat,build] "pytest${{ matrix.pytest-version }}"
57
+ pip uninstall -y pytest-benchmark
58
+ - if : matrix.config == 'pytest-benchmark-4'
59
+ name : Install pytest-benchmark 4.0.0
60
+ run : pip install pytest-benchmark~=4.0.0
61
+ - if : matrix.config == 'pytest-benchmark-5'
62
+ name : Install pytest-benchmark 5.0.0
63
+ run : pip install pytest-benchmark~=5.0.0
58
64
- name : Run tests
59
65
run : pytest -vs
60
66
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ dependencies = [
48
48
build = [" semver>=3.0.2" ]
49
49
lint = [" mypy ~= 1.11.2" , " ruff ~= 0.6.5" ]
50
50
compat = [
51
- " pytest-benchmark ~= 4 .0.0" ,
51
+ " pytest-benchmark ~= 5 .0.0" ,
52
52
" pytest-xdist ~= 3.6.1" ,
53
53
# "pytest-speed>=0.3.5",
54
54
]
Original file line number Diff line number Diff line change @@ -320,6 +320,18 @@ def pytest_sessionfinish(session: pytest.Session, exitstatus):
320
320
class BenchmarkFixture :
321
321
"""The fixture that can be used to benchmark a function."""
322
322
323
+ @property # type: ignore
324
+ def __class__ (self ):
325
+ # Bypass the pytest-benchmark fixture class check
326
+ # https://github.com/ionelmc/pytest-benchmark/commit/d6511e3474931feb4e862948128e0c389acfceec
327
+ if IS_PYTEST_BENCHMARK_INSTALLED :
328
+ from pytest_benchmark .fixture import (
329
+ BenchmarkFixture as PytestBenchmarkFixture ,
330
+ )
331
+
332
+ return PytestBenchmarkFixture
333
+ return BenchmarkFixture
334
+
323
335
def __init__ (self , request : pytest .FixtureRequest ):
324
336
self .extra_info : dict = {}
325
337
You can’t perform that action at this time.
0 commit comments