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
5 changes: 3 additions & 2 deletions src/poetry/core/constraints/version/patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@
re.VERBOSE | re.IGNORECASE,
)

# pattern for non Python versions such as OS versions in `platform_release`
RELEASE_PATTERN = r"""
(?P<release>[0-9]+(?:\.[0-9]+)*)
(?:(\+|-)?(?P<build>
[0-9a-zA-Z-]+
(?:\.[0-9a-zA-Z-]+)*
[0-9a-zA-Z+-]+
(?:\.[0-9a-zA-Z+-]+)*
))?
"""

Expand Down
5 changes: 4 additions & 1 deletion tests/constraints/version/test_parse_constraint.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,9 @@ def test_parse_constraint_with_white_space_padding(
assert parse_constraint(constraint) == expected


@pytest.mark.parametrize("constraint", ["4.9.253-tegra", "2022Server"])
@pytest.mark.parametrize(
"constraint", ["4.9.253-tegra", "2022Server", "6.12.74+deb13+1-amd64"]
)
def test_parse_marker_constraint_does_not_allow_invalid_version(
constraint: str,
) -> None:
Expand All @@ -597,6 +599,7 @@ def test_parse_marker_constraint_does_not_allow_invalid_version(
[
("4.9.253-tegra", Version.from_parts(4, 9, 253, local="tegra")),
("2022Server", Version.from_parts(2022, local="Server")),
("6.12.74+deb13+1-amd64", Version.from_parts(6, 12, 74, local="deb13+1-amd64")),
],
)
def test_parse_marker_constraint_does_allow_invalid_version_if_requested(
Expand Down