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

Prefix dev, rc, and post with "." to make compatible with PEP440 #62

Merged
merged 2 commits into from
Oct 14, 2020
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
6 changes: 3 additions & 3 deletions src/incremental/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,17 +204,17 @@ def public(self):
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 = ""
else:
post = "post%s" % (self.post,)
post = ".post%s" % (self.post,)

if self.dev is None:
dev = ""
else:
dev = "dev%s" % (self.dev,)
dev = ".dev%s" % (self.dev,)

return '%r.%d.%d%s%s%s' % (self.major,
self.minor,
Expand Down
18 changes: 9 additions & 9 deletions src/incremental/tests/test_update.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,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.4rc1"
next_released_version = "inctestpkg 1.2.4.rc1"
""")

def test_rc_with_existing_rc(self):
Expand Down Expand Up @@ -390,7 +390,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.3rc2"
next_released_version = "inctestpkg 1.2.3.rc2"
""")

def test_rc_with_no_rc(self):
Expand Down Expand Up @@ -427,7 +427,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.0rc1"
next_released_version = "inctestpkg 16.8.0.rc1"
""")

def test_full_with_rc(self):
Expand Down Expand Up @@ -457,7 +457,7 @@ 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.0rc1"
next_released_version = "inctestpkg 16.8.0.rc1"
""")

_run(u'inctestpkg', path=None, newversion=None, patch=False, rc=False,
Expand Down Expand Up @@ -586,7 +586,7 @@ def test_post_with_existing_post(self):
b"""
from incremental import Version
introduced_in = Version('inctestpkg', 1, 2, 3, post=2).short()
next_released_version = "inctestpkg 1.2.3post2"
next_released_version = "inctestpkg 1.2.3.post2"
""")

def test_no_mix_newversion(self):
Expand Down Expand Up @@ -680,11 +680,11 @@ def test_no_mix_create(self):

def test_newversion(self):
"""
`incremental.update package --newversion=1.2.3rc1post2dev3`, will
`incremental.update package --newversion=1.2.3.rc1.post2.dev3`, will
set that version in the package.
"""
out = []
_run(u'inctestpkg', path=None, newversion="1.2.3rc1post2dev3",
_run(u'inctestpkg', path=None, newversion="1.2.3.rc1.post2.dev3",
patch=False, rc=False, post=False, dev=False, create=False,
_date=self.date, _getcwd=self.getcwd, _print=out.append)

Expand All @@ -707,7 +707,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.3rc1post2dev3"
next_released_version = "inctestpkg 1.2.3.rc1.post2.dev3"
"""))

def test_newversion_bare(self):
Expand Down Expand Up @@ -821,5 +821,5 @@ 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.0rc1"
next_released_version = "inctestpkg 16.8.0.rc1"
""")
36 changes: 18 additions & 18 deletions src/incremental/tests/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,23 +351,23 @@ def test_strWithPrerelease(self):
as a release candidate.
"""
self.assertEqual(str(Version("dummy", 1, 0, 0, prerelease=1)),
"[dummy, version 1.0.0rc1]")
"[dummy, version 1.0.0.rc1]")

def test_strWithReleaseCandidate(self):
"""
Calling C{str} on a version with a release candidate includes the
release candidate.
"""
self.assertEqual(str(Version("dummy", 1, 0, 0, release_candidate=1)),
"[dummy, version 1.0.0rc1]")
"[dummy, version 1.0.0.rc1]")

def test_strWithPost(self):
"""
Calling C{str} on a version with a postrelease includes the
postrelease.
"""
self.assertEqual(str(Version("dummy", 1, 0, 0, post=1)),
"[dummy, version 1.0.0post1]")
"[dummy, version 1.0.0.post1]")

def test_strWithDevAndReleaseCandidate(self):
"""
Expand All @@ -376,23 +376,23 @@ def test_strWithDevAndReleaseCandidate(self):
"""
self.assertEqual(str(Version("dummy", 1, 0, 0,
release_candidate=1, dev=2)),
"[dummy, version 1.0.0rc1dev2]")
"[dummy, version 1.0.0.rc1.dev2]")

def test_strWithDev(self):
"""
Calling C{str} on a version with a dev release includes the dev
release.
"""
self.assertEqual(str(Version("dummy", 1, 0, 0, dev=1)),
"[dummy, version 1.0.0dev1]")
"[dummy, version 1.0.0.dev1]")

def test_strWithDevAndPost(self):
"""
Calling C{str} on a version with a postrelease and dev release
includes the postrelease and the dev release.
"""
self.assertEqual(str(Version("dummy", 1, 0, 0, post=1, dev=2)),
"[dummy, version 1.0.0post1dev2]")
"[dummy, version 1.0.0.post1.dev2]")

def testShort(self):
self.assertEqual(Version('dummy', 1, 2, 3).short(), '1.2.3')
Expand All @@ -412,7 +412,7 @@ def test_getVersionStringWithPrerelease(self):
"""
self.assertEqual(
getVersionString(Version("whatever", 8, 0, 0, prerelease=1)),
"whatever 8.0.0rc1")
"whatever 8.0.0.rc1")

def test_getVersionStringWithReleaseCandidate(self):
"""
Expand All @@ -421,7 +421,7 @@ def test_getVersionStringWithReleaseCandidate(self):
self.assertEqual(
getVersionString(Version("whatever", 8, 0, 0,
release_candidate=1)),
"whatever 8.0.0rc1")
"whatever 8.0.0.rc1")

def test_getVersionStringWithPost(self):
"""
Expand All @@ -430,7 +430,7 @@ def test_getVersionStringWithPost(self):
self.assertEqual(
getVersionString(Version("whatever", 8, 0, 0,
post=1)),
"whatever 8.0.0post1")
"whatever 8.0.0.post1")

def test_getVersionStringWithDev(self):
"""
Expand All @@ -439,7 +439,7 @@ def test_getVersionStringWithDev(self):
self.assertEqual(
getVersionString(Version("whatever", 8, 0, 0,
dev=1)),
"whatever 8.0.0dev1")
"whatever 8.0.0.dev1")

def test_getVersionStringWithDevAndRC(self):
"""
Expand All @@ -449,7 +449,7 @@ def test_getVersionStringWithDevAndRC(self):
self.assertEqual(
getVersionString(Version("whatever", 8, 0, 0,
release_candidate=2, dev=1)),
"whatever 8.0.0rc2dev1")
"whatever 8.0.0.rc2.dev1")

def test_getVersionStringWithDevAndPost(self):
"""
Expand All @@ -459,7 +459,7 @@ def test_getVersionStringWithDevAndPost(self):
self.assertEqual(
getVersionString(Version("whatever", 8, 0, 0,
post=2, dev=1)),
"whatever 8.0.0post2dev1")
"whatever 8.0.0.post2.dev1")

def test_baseWithNEXT(self):
"""
Expand All @@ -478,28 +478,28 @@ def test_baseWithPrerelease(self):
The base version includes 'rcX' for versions with prereleases.
"""
self.assertEqual(Version("foo", 1, 0, 0, prerelease=8).base(),
"1.0.0rc8")
"1.0.0.rc8")

def test_baseWithPost(self):
"""
The base version includes 'postX' for versions with postreleases.
"""
self.assertEqual(Version("foo", 1, 0, 0, post=8).base(),
"1.0.0post8")
"1.0.0.post8")

def test_baseWithDev(self):
"""
The base version includes 'devX' for versions with dev releases.
"""
self.assertEqual(Version("foo", 1, 0, 0, dev=8).base(),
"1.0.0dev8")
"1.0.0.dev8")

def test_baseWithReleaseCandidate(self):
"""
The base version includes 'rcX' for versions with prereleases.
"""
self.assertEqual(Version("foo", 1, 0, 0, release_candidate=8).base(),
"1.0.0rc8")
"1.0.0.rc8")

def test_baseWithDevAndRC(self):
"""
Expand All @@ -508,7 +508,7 @@ def test_baseWithDevAndRC(self):
"""
self.assertEqual(Version("foo", 1, 0, 0,
release_candidate=2, dev=8).base(),
"1.0.0rc2dev8")
"1.0.0.rc2.dev8")

def test_baseWithDevAndPost(self):
"""
Expand All @@ -517,4 +517,4 @@ def test_baseWithDevAndPost(self):
"""
self.assertEqual(Version("foo", 1, 0, 0,
post=2, dev=8).base(),
"1.0.0post2dev8")
"1.0.0.post2.dev8")