Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix an issue where dependencies with an epoch are parsed as empty #316

Merged
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
3 changes: 0 additions & 3 deletions src/poetry/core/semver/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ def next_breaking(self) -> Version:

return self.stable.next_major()

def first_pre_release(self) -> Version:
return self.__class__(release=self.release, pre=ReleaseTag("alpha"))

@property
def min(self) -> Version:
return self
Expand Down
2 changes: 1 addition & 1 deletion src/poetry/core/semver/version_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __init__(
and not full_max.is_postrelease()
and (min is None or min.is_stable() or min.release != full_max.release)
):
full_max = full_max.first_pre_release()
full_max = full_max.first_prerelease()

self._min = min
self._max = max
Expand Down
27 changes: 27 additions & 0 deletions tests/semver/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,33 @@ def test_parse_constraint_multi(input: str):
)


@pytest.mark.parametrize(
"input, output",
[
(
">1!2,<=2!3",
VersionRange(
Version.from_parts(2, 0, 0, epoch=1),
Version.from_parts(3, 0, 0, epoch=2),
include_min=False,
include_max=True,
),
),
(
">=1!2,<2!3",
VersionRange(
Version.from_parts(2, 0, 0, epoch=1),
Version.from_parts(3, 0, 0, epoch=2),
include_min=True,
include_max=False,
),
),
],
)
def test_parse_constraint_multi_with_epochs(input: str, output: VersionRange):
assert parse_constraint(input) == output


@pytest.mark.parametrize(
"input",
[">=2.7,!=3.0.*,!=3.1.*", ">=2.7, !=3.0.*, !=3.1.*", ">= 2.7, != 3.0.*, != 3.1.*"],
Expand Down