diff --git a/dvc/testing/benchmarks/cli/commands/test_data_status.py b/dvc/testing/benchmarks/cli/commands/test_data_status.py index 49a9b76671c..d2c73561ef2 100644 --- a/dvc/testing/benchmarks/cli/commands/test_data_status.py +++ b/dvc/testing/benchmarks/cli/commands/test_data_status.py @@ -1,9 +1,5 @@ from shutil import rmtree -import pytest - -pytestmark = pytest.mark.requires(minversion=(2, 15, 0), reason="new command") - def test_data_status(bench_dvc, tmp_dir, scm, dvc, make_dataset): args = ("data", "status") diff --git a/dvc/testing/benchmarks/cli/commands/test_exp_show.py b/dvc/testing/benchmarks/cli/commands/test_exp_show.py index 2b1ace5098e..0dad78ea438 100644 --- a/dvc/testing/benchmarks/cli/commands/test_exp_show.py +++ b/dvc/testing/benchmarks/cli/commands/test_exp_show.py @@ -1,7 +1,3 @@ -import pytest - - -@pytest.mark.requires(minversion=(2, 28, 0)) def test_exp_show(make_project, monkeypatch, bench_dvc, dvc_bin): url = "https://github.com/iterative/example-get-started" rev = "main" diff --git a/dvc/testing/benchmarks/cli/commands/test_import.py b/dvc/testing/benchmarks/cli/commands/test_import.py index f96295dd68e..4884bed4b6f 100644 --- a/dvc/testing/benchmarks/cli/commands/test_import.py +++ b/dvc/testing/benchmarks/cli/commands/test_import.py @@ -2,6 +2,12 @@ @pytest.mark.flaky(reruns=3) +@pytest.mark.requires( + "!=3.53.*,!=3.54.0", + reason="Takes 10 mins to run. Regression in 3.53.0, fixed in 3.54.1", +) +# Introduced in https://github.com/iterative/dvc/pull/10388. +# Fixed in https://github.com/iterative/dvc/pull/10531. def test_import(bench_dvc, tmp_dir, scm, dvc, make_dataset, remote): dataset = make_dataset( cache=False, files=False, dvcfile=True, commit=True, remote=True diff --git a/dvc/testing/benchmarks/cli/commands/test_plots.py b/dvc/testing/benchmarks/cli/commands/test_plots.py index 2ed3210dac9..71a2f32414b 100644 --- a/dvc/testing/benchmarks/cli/commands/test_plots.py +++ b/dvc/testing/benchmarks/cli/commands/test_plots.py @@ -1,10 +1,7 @@ -import pytest - from dvc.repo import Repo from dvc.testing.benchmarks.fixtures import _pull -@pytest.mark.requires(minversion=(2, 34, 0), reason="top-level plots not supported") def test_plots(project, bench_dvc): with Repo() as dvc: _pull(dvc) diff --git a/dvc/testing/benchmarks/fixtures.py b/dvc/testing/benchmarks/fixtures.py index 749d5ab37af..903c5a48ce8 100644 --- a/dvc/testing/benchmarks/fixtures.py +++ b/dvc/testing/benchmarks/fixtures.py @@ -133,17 +133,19 @@ def parse_tuple(version_string): @pytest.fixture def dvc_bin(request, make_dvc_bin): if marker := request.node.get_closest_marker("requires"): - minversion = marker.kwargs.get("minversion") or first(marker.args) - assert minversion, ( - "'minversion' needs to be specified as" - " a positional or a keyword argument" - ) - reason = marker.kwargs.get("reason", "") - if isinstance(minversion, str): - minversion = parse_tuple(minversion) - if make_dvc_bin.version < minversion: - version_repr = ".".join(map(str, minversion)) - pytest.skip(f"requires dvc>={version_repr}: {reason}") + from packaging.specifiers import SpecifierSet + from packaging.version import Version + + spec = first(marker.args) + assert spec is not None + spec = SpecifierSet(spec) if isinstance(spec, str) else spec + reason = marker.kwargs["reason"] + dvc_version = ".".join(map(str, make_dvc_bin.version)) + if Version(dvc_version) not in spec: + pytest.skip( + f"Version {dvc_version} " + f"does not satisfy requirement {spec!r}: {reason}" + ) return make_dvc_bin diff --git a/dvc/testing/benchmarks/plugin.py b/dvc/testing/benchmarks/plugin.py index 9d3b142ec4a..b1b9f9de14f 100644 --- a/dvc/testing/benchmarks/plugin.py +++ b/dvc/testing/benchmarks/plugin.py @@ -30,7 +30,8 @@ def __init__(self): def pytest_configure(config): config.addinivalue_line( - "markers", "requires(minversion): mark a test as requiring minimum DVC version" + "markers", + "requires(spec): mark a test to run only on versions that satisfy the spec", ) config.bench_config = DVCBenchConfig()