Skip to content

Commit

Permalink
Merge pull request #95 from twisted/81-dotless
Browse files Browse the repository at this point in the history
Don't add a dot before an rc specifier
  • Loading branch information
twm authored Jul 23, 2024
2 parents 5433dfd + d482dff commit 0899fd9
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 55 deletions.
2 changes: 1 addition & 1 deletion src/incremental/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def public(self): # type: () -> str
if self.release_candidate is None:
rc = ""
else:
rc = ".rc%s" % (self.release_candidate,)
rc = "rc%s" % (self.release_candidate,)

if self.post is None:
post = ""
Expand Down
1 change: 1 addition & 0 deletions src/incremental/newsfragments/81.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Incremental no longer inserts a dot before the rc version component (i.e., ``1.2.3rc1`` instead of ``1.2.3.rc1``), resulting in version numbers in the `canonical format <https://packaging.python.org/en/latest/specifications/version-specifiers/#public-version-identifiers>`__.
84 changes: 39 additions & 45 deletions src/incremental/tests/test_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

class NonCreatedUpdateTests(TestCase):
def setUp(self):

self.srcdir = FilePath(self.mktemp())
self.srcdir.makedirs()

Expand Down Expand Up @@ -84,7 +83,6 @@ def test_create(self):

class MissingTests(TestCase):
def setUp(self):

self.srcdir = FilePath(self.mktemp())
self.srcdir.makedirs()

Expand Down Expand Up @@ -124,7 +122,7 @@ def test_path(self):
out = []
with self.assertRaises(ValueError):
_run(
u"inctestpkg",
"inctestpkg",
path=None,
newversion=None,
patch=False,
Expand All @@ -140,7 +138,6 @@ def test_path(self):

class CreatedUpdateInSrcTests(TestCase):
def setUp(self):

self.srcdir = FilePath(self.mktemp())
self.srcdir.makedirs()

Expand Down Expand Up @@ -179,7 +176,7 @@ def test_path(self):
"""
out = []
_run(
u"inctestpkg",
"inctestpkg",
path=None,
newversion=None,
patch=False,
Expand Down Expand Up @@ -210,7 +207,7 @@ def test_path(self):
)

_run(
u"inctestpkg",
"inctestpkg",
path=None,
newversion=None,
patch=False,
Expand Down Expand Up @@ -242,11 +239,9 @@ def test_path(self):


class CreatedUpdateTests(TestCase):

maxDiff = None

def setUp(self):

self.srcdir = FilePath(self.mktemp())
self.srcdir.makedirs()

Expand Down Expand Up @@ -283,7 +278,7 @@ def test_path(self):
"""
out = []
_run(
u"inctestpkg",
"inctestpkg",
path=self.packagedir.path,
newversion=None,
patch=False,
Expand Down Expand Up @@ -318,7 +313,7 @@ def test_dev(self):
"""
out = []
_run(
u"inctestpkg",
"inctestpkg",
path=None,
newversion=None,
patch=False,
Expand Down Expand Up @@ -354,7 +349,7 @@ def test_patch(self):
"""
out = []
_run(
u"inctestpkg",
"inctestpkg",
path=None,
newversion=None,
patch=True,
Expand Down Expand Up @@ -406,7 +401,7 @@ def test_patch_with_prerelease_and_dev(self):

out = []
_run(
u"inctestpkg",
"inctestpkg",
path=None,
newversion=None,
patch=True,
Expand Down Expand Up @@ -442,7 +437,7 @@ def test_rc_patch(self):
"""
out = []
_run(
u"inctestpkg",
"inctestpkg",
path=None,
newversion=None,
patch=True,
Expand Down Expand Up @@ -475,7 +470,7 @@ def test_rc_patch(self):
b"""
from incremental import Version
introduced_in = Version("inctestpkg", 1, 2, 4, release_candidate=1).short()
next_released_version = "inctestpkg 1.2.4.rc1"
next_released_version = "inctestpkg 1.2.4rc1"
""",
)

Expand All @@ -494,7 +489,7 @@ def test_rc_with_existing_rc(self):

out = []
_run(
u"inctestpkg",
"inctestpkg",
path=None,
newversion=None,
patch=False,
Expand Down Expand Up @@ -527,7 +522,7 @@ def test_rc_with_existing_rc(self):
b"""
from incremental import Version
introduced_in = Version("inctestpkg", 1, 2, 3, release_candidate=2).short()
next_released_version = "inctestpkg 1.2.3.rc2"
next_released_version = "inctestpkg 1.2.3rc2"
""",
)

Expand All @@ -547,7 +542,7 @@ def test_rc_with_no_rc(self):

out = []
_run(
u"inctestpkg",
"inctestpkg",
path=None,
newversion=None,
patch=False,
Expand Down Expand Up @@ -580,7 +575,7 @@ def test_rc_with_no_rc(self):
b"""
from incremental import Version
introduced_in = Version("inctestpkg", 16, 8, 0, release_candidate=1).short()
next_released_version = "inctestpkg 16.8.0.rc1"
next_released_version = "inctestpkg 16.8.0rc1"
""",
)

Expand All @@ -591,7 +586,7 @@ def test_full_with_rc(self):
"""
out = []
_run(
u"inctestpkg",
"inctestpkg",
path=None,
newversion=None,
patch=False,
Expand Down Expand Up @@ -624,12 +619,12 @@ def test_full_with_rc(self):
b"""
from incremental import Version
introduced_in = Version("inctestpkg", 16, 8, 0, release_candidate=1).short()
next_released_version = "inctestpkg 16.8.0.rc1"
next_released_version = "inctestpkg 16.8.0rc1"
""",
)

_run(
u"inctestpkg",
"inctestpkg",
path=None,
newversion=None,
patch=False,
Expand Down Expand Up @@ -674,7 +669,7 @@ def test_full_without_rc(self):
out = []
with self.assertRaises(ValueError) as e:
_run(
u"inctestpkg",
"inctestpkg",
path=None,
newversion=None,
patch=False,
Expand All @@ -698,7 +693,7 @@ def test_post(self):
"""
out = []
_run(
u"inctestpkg",
"inctestpkg",
path=None,
newversion=None,
patch=False,
Expand Down Expand Up @@ -743,7 +738,7 @@ def test_post_with_prerelease_and_dev(self):

out = []
_run(
u"inctestpkg",
"inctestpkg",
path=None,
newversion=None,
patch=False,
Expand Down Expand Up @@ -787,7 +782,7 @@ def test_post_with_existing_post(self):

out = []
_run(
u"inctestpkg",
"inctestpkg",
path=None,
newversion=None,
patch=False,
Expand Down Expand Up @@ -832,7 +827,7 @@ def test_no_mix_newversion(self):
out = []
with self.assertRaises(ValueError) as e:
_run(
u"inctestpkg",
"inctestpkg",
path=None,
newversion="1",
patch=True,
Expand All @@ -848,7 +843,7 @@ def test_no_mix_newversion(self):

with self.assertRaises(ValueError) as e:
_run(
u"inctestpkg",
"inctestpkg",
path=None,
newversion="1",
patch=False,
Expand All @@ -864,7 +859,7 @@ def test_no_mix_newversion(self):

with self.assertRaises(ValueError) as e:
_run(
u"inctestpkg",
"inctestpkg",
path=None,
newversion="1",
patch=False,
Expand All @@ -880,7 +875,7 @@ def test_no_mix_newversion(self):

with self.assertRaises(ValueError) as e:
_run(
u"inctestpkg",
"inctestpkg",
path=None,
newversion="1",
patch=False,
Expand All @@ -901,7 +896,7 @@ def test_no_mix_dev(self):
out = []
with self.assertRaises(ValueError) as e:
_run(
u"inctestpkg",
"inctestpkg",
path=None,
newversion=None,
patch=True,
Expand All @@ -917,7 +912,7 @@ def test_no_mix_dev(self):

with self.assertRaises(ValueError) as e:
_run(
u"inctestpkg",
"inctestpkg",
path=None,
newversion=None,
patch=False,
Expand All @@ -933,7 +928,7 @@ def test_no_mix_dev(self):

with self.assertRaises(ValueError) as e:
_run(
u"inctestpkg",
"inctestpkg",
path=None,
newversion=None,
patch=False,
Expand All @@ -955,7 +950,7 @@ def test_no_mix_create(self):
out = []
with self.assertRaises(ValueError) as e:
_run(
u"inctestpkg",
"inctestpkg",
path=None,
newversion=None,
patch=True,
Expand All @@ -971,7 +966,7 @@ def test_no_mix_create(self):

with self.assertRaises(ValueError) as e:
_run(
u"inctestpkg",
"inctestpkg",
path=None,
newversion="1",
patch=False,
Expand All @@ -987,7 +982,7 @@ def test_no_mix_create(self):

with self.assertRaises(ValueError) as e:
_run(
u"inctestpkg",
"inctestpkg",
path=None,
newversion=None,
patch=False,
Expand All @@ -1003,7 +998,7 @@ def test_no_mix_create(self):

with self.assertRaises(ValueError) as e:
_run(
u"inctestpkg",
"inctestpkg",
path=None,
newversion=None,
patch=False,
Expand All @@ -1019,7 +1014,7 @@ def test_no_mix_create(self):

with self.assertRaises(ValueError) as e:
_run(
u"inctestpkg",
"inctestpkg",
path=None,
newversion=None,
patch=False,
Expand All @@ -1035,14 +1030,14 @@ def test_no_mix_create(self):

def test_newversion(self):
"""
`incremental.update package --newversion=1.2.3.rc1.post2.dev3`, will
`incremental.update package --newversion=1.2.3rc1.post2.dev3`, will
set that version in the package.
"""
out = []
_run(
u"inctestpkg",
"inctestpkg",
path=None,
newversion="1.2.3.rc1.post2.dev3",
newversion="1.2.3rc1.post2.dev3",
patch=False,
rc=False,
post=False,
Expand Down Expand Up @@ -1076,7 +1071,7 @@ def test_newversion(self):
from incremental import Version
introduced_in = Version("inctestpkg", 1, 2, 3, """
b"""release_candidate=1, post=2, dev=3).short()
next_released_version = "inctestpkg 1.2.3.rc1.post2.dev3"
next_released_version = "inctestpkg 1.2.3rc1.post2.dev3"
"""
),
)
Expand All @@ -1088,7 +1083,7 @@ def test_newversion_bare(self):
"""
out = []
_run(
u"inctestpkg",
"inctestpkg",
path=None,
newversion="1",
patch=False,
Expand Down Expand Up @@ -1132,7 +1127,7 @@ def test_newversion_bare_major_minor(self):
"""
out = []
_run(
u"inctestpkg",
"inctestpkg",
path=None,
newversion="1.1",
patch=False,
Expand Down Expand Up @@ -1172,7 +1167,6 @@ def test_newversion_bare_major_minor(self):

class ScriptTests(TestCase):
def setUp(self):

self.srcdir = FilePath(self.mktemp())
self.srcdir.makedirs()

Expand Down Expand Up @@ -1256,6 +1250,6 @@ def test_insufficient_args(self):
b"""
from incremental import Version
introduced_in = Version("inctestpkg", 16, 8, 0, release_candidate=1).short()
next_released_version = "inctestpkg 16.8.0.rc1"
next_released_version = "inctestpkg 16.8.0rc1"
""",
)
Loading

0 comments on commit 0899fd9

Please sign in to comment.