Skip to content

Commit

Permalink
benchmarks: fix for local versions
Browse files Browse the repository at this point in the history
  • Loading branch information
skshetry committed Aug 20, 2024
1 parent 6f24d04 commit e76aaea
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions dvc/testing/benchmarks/fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,17 @@ def _dvc_bin(*args):
def dvc_bin(request, make_dvc_bin):
if marker := request.node.get_closest_marker("requires"):
from packaging.specifiers import SpecifierSet
from packaging.version import Version
from packaging.version import Version, parse

spec = first(marker.args)
assert spec is not None
spec = SpecifierSet(spec) if isinstance(spec, str) else spec
reason = marker.kwargs["reason"]
if Version(make_dvc_bin.version) not in spec:
dvc_version = make_dvc_bin.version
version = Version(parse(dvc_version).base_version)
if version not in spec:
pytest.skip(
f"Version {make_dvc_bin.version} "
f"Version {dvc_version} "
f"does not satisfy requirement {spec!r}: {reason}"
)
return make_dvc_bin
Expand Down

0 comments on commit e76aaea

Please sign in to comment.