Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/univers/version_constraint.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def split(string):
# "<<2.3" and ">>2.3" in VERS constraints which are explicitly not supported in VERS.
elif version and version[0] in "<>!=*":
raise ValueError(f"Unknown comparator in constraint: {constraint_string!r}")

return comparator, version

# default to equality
Expand Down
2 changes: 1 addition & 1 deletion src/univers/version_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -1016,7 +1016,7 @@ class EbuildVersionRange(VersionRange):


class AlpineLinuxVersionRange(VersionRange):
scheme = "alpine"
scheme = "apk"
version_class = versions.AlpineLinuxVersion


Expand Down
3 changes: 2 additions & 1 deletion tests/test_version_constraint.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,11 @@ def test_invert_opertaion(original, inverted):
else:
assert constraint.invert() is None


@pytest.mark.parametrize("spec", ["<<2.3", ">>2.3"])
def test_invalid_vers_comparator_prefixes(spec):
with pytest.raises(ValueError, match="Unknown comparator"):
VersionConstraint.from_string(
string=spec,
version_class=versions.SemverVersion,
)
)
7 changes: 7 additions & 0 deletions tests/test_version_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,13 @@ def test_AlpineLinuxVersionRange_from_versions():
assert version_range == expected


def test_AlpineLinuxVersionRange_has_apk_scheme():
sequence = ["3.18.0", "2.14.9-r1", "3.0.0"]
expected = "vers:apk/2.14.9-r1|3.0.0|3.18.0"
version_range = AlpineLinuxVersionRange.from_versions(sequence).to_string()
assert version_range == expected


def test_VersionRange_from_versions_with_empty_constraints():
sequence = []
expected = None
Expand Down