Skip to content

Commit

Permalink
Fix caret constraint parsing (#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
sdispater committed Apr 30, 2021
1 parent 3f718c5 commit 5349ab2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion poetry/core/semver/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def next_breaking(self) -> "Version":

return self.next_patch()

return self.next_major()
return self.stable.next_major()

def first_pre_release(self) -> "Version":
return self.__class__(release=self.release, pre=ReleaseTag("alpha"))
Expand Down
17 changes: 17 additions & 0 deletions tests/semver/test_parse_constraint.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from poetry.core.semver.version import Version
from poetry.core.semver.version_range import VersionRange
from poetry.core.semver.version_union import VersionUnion
from poetry.core.version.pep440 import ReleaseTag


@pytest.mark.parametrize(
Expand Down Expand Up @@ -171,6 +172,22 @@
),
),
),
(
"^1.0.0a1",
VersionRange(
min=Version.from_parts(1, 0, 0, pre=ReleaseTag("a", 1)),
max=Version.from_parts(2, 0, 0),
include_min=True,
),
),
(
"~1.0.0a1",
VersionRange(
min=Version.from_parts(1, 0, 0, pre=ReleaseTag("a", 1)),
max=Version.from_parts(1, 1, 0),
include_min=True,
),
),
],
)
def test_parse_constraint(constraint, version):
Expand Down

0 comments on commit 5349ab2

Please sign in to comment.