Skip to content

Commit

Permalink
fix issue with pytest-benchmark==5 (#10618)
Browse files Browse the repository at this point in the history
  • Loading branch information
skshetry authored Nov 11, 2024
1 parent 2431ec6 commit 9a05068
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions dvc/testing/benchmarks/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ def _make_bench(name):
import pytest_benchmark.plugin

# hack from https://github.com/ionelmc/pytest-benchmark/issues/166
bench = pytest_benchmark.plugin.benchmark.__pytest_wrapped__.obj(request)
bench_gen = pytest_benchmark.plugin.benchmark.__pytest_wrapped__.obj(request)
bench = next(bench_gen)

suffix = f"-{name}"

Expand All @@ -172,7 +173,7 @@ def _bench_dvc(*args, **kwargs):
name = kwargs.pop("name", None)
name = f"-{name}" if name else ""
bench = make_bench(args[0] + name)
if request.config.getoption("--benchmark-cprofile-dump") or kwargs.pop(
if request.config.getoption("--dvc-benchmark-cprofile-dump") or kwargs.pop(
"cprofile", False
):
cprofile_results = request.config.invocation_params.dir / "prof"
Expand Down
2 changes: 1 addition & 1 deletion dvc/testing/benchmarks/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def pytest_addoption(parser):
)

parser.addoption(
"--benchmark-cprofile-dump",
"--dvc-benchmark-cprofile-dump",
action="store_true",
default=False,
help="Save cprofile results",
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ s3 = ["dvc-s3>=3.2.0,<4"]
ssh = ["dvc-ssh>=4,<5"]
ssh_gssapi = ["dvc-ssh[gssapi]>=4,<5"]
testing = [
"pytest-benchmark[histogram]",
"pytest-benchmark[histogram]>=5,<6",
"pytest-test-utils",
"uv",
]
Expand Down

0 comments on commit 9a05068

Please sign in to comment.