Ejemplo n.º 1
0
 def test_invalid_tag_ignored(self):
     # Fix for bug 1356784 - we treated any tag as a version, not just those
     # that are valid versions.
     self.repo.commit()
     self.repo.tag('1')
     self.repo.commit()
     # when the tree is tagged and its wrong:
     self.repo.tag('badver')
     version = packaging._get_version_from_git()
     self.assertThat(version, matchers.StartsWith('1.0.1.dev1.g'))
     # When the tree isn't tagged, we also fall through.
     self.repo.commit()
     version = packaging._get_version_from_git()
     self.assertThat(version, matchers.StartsWith('1.0.1.dev2.g'))
     # We don't fall through x.y versions
     self.repo.commit()
     self.repo.tag('1.2')
     self.repo.commit()
     self.repo.tag('badver2')
     version = packaging._get_version_from_git()
     self.assertThat(version, matchers.StartsWith('1.2.1.dev1.g'))
     # Or x.y.z versions
     self.repo.commit()
     self.repo.tag('1.2.3')
     self.repo.commit()
     self.repo.tag('badver3')
     version = packaging._get_version_from_git()
     self.assertThat(version, matchers.StartsWith('1.2.4.dev1.g'))
     # Or alpha/beta/pre versions
     self.repo.commit()
     self.repo.tag('1.2.4.0a1')
     self.repo.commit()
     self.repo.tag('badver4')
     version = packaging._get_version_from_git()
     self.assertThat(version, matchers.StartsWith('1.2.4.dev1.g'))
Ejemplo n.º 2
0
 def test_skip_write_git_changelog(self):
     # Fix for bug 1467440
     self.repo.commit()
     self.repo.tag('1.2.3')
     os.environ['SKIP_WRITE_GIT_CHANGELOG'] = '1'
     version = packaging._get_version_from_git('1.2.3')
     self.assertEqual('1.2.3', version)
Ejemplo n.º 3
0
 def test_skip_write_git_changelog(self):
     # Fix for bug 1467440
     self.repo.commit()
     self.repo.tag("1.2.3")
     os.environ["SKIP_WRITE_GIT_CHANGELOG"] = "1"
     version = packaging._get_version_from_git("1.2.3")
     self.assertEqual("1.2.3", version)
Ejemplo n.º 4
0
 def test_valid_tag_honoured(self):
     # Fix for bug 1370608 - we converted any target into a 'dev version'
     # even if there was a distance of 0 - indicating that we were on the
     # tag itself.
     self.repo.commit()
     self.repo.tag('1.3.0.0a1')
     version = packaging._get_version_from_git()
     self.assertEqual('1.3.0.0a1', version)
Ejemplo n.º 5
0
 def test_invalid_tag_ignored(self):
     # Fix for bug 1356784 - we treated any tag as a version, not just those
     # that are valid versions.
     self.repo.commit()
     self.repo.tag("1")
     self.repo.commit()
     # when the tree is tagged and its wrong:
     self.repo.tag("badver")
     version = packaging._get_version_from_git()
     self.assertThat(version, matchers.StartsWith("1.0.1.dev1"))
     # When the tree isn't tagged, we also fall through.
     self.repo.commit()
     version = packaging._get_version_from_git()
     self.assertThat(version, matchers.StartsWith("1.0.1.dev2"))
     # We don't fall through x.y versions
     self.repo.commit()
     self.repo.tag("1.2")
     self.repo.commit()
     self.repo.tag("badver2")
     version = packaging._get_version_from_git()
     self.assertThat(version, matchers.StartsWith("1.2.1.dev1"))
     # Or x.y.z versions
     self.repo.commit()
     self.repo.tag("1.2.3")
     self.repo.commit()
     self.repo.tag("badver3")
     version = packaging._get_version_from_git()
     self.assertThat(version, matchers.StartsWith("1.2.4.dev1"))
     # Or alpha/beta/pre versions
     self.repo.commit()
     self.repo.tag("1.2.4.0a1")
     self.repo.commit()
     self.repo.tag("badver4")
     version = packaging._get_version_from_git()
     self.assertThat(version, matchers.StartsWith("1.2.4.0a2.dev1"))
     # Non-release related tags are ignored.
     self.repo.commit()
     self.repo.tag("2")
     self.repo.commit()
     self.repo.tag("non-release-tag/2014.12.16-1")
     version = packaging._get_version_from_git()
     self.assertThat(version, matchers.StartsWith("2.0.1.dev1"))
Ejemplo n.º 6
0
 def test_untagged_version_minor_bump(self):
     self.repo.commit()
     self.repo.tag('1.2.3')
     self.repo.commit('sem-ver: deprecation')
     version = packaging._get_version_from_git()
     self.assertThat(version, matchers.StartsWith('1.3.0.dev1'))
Ejemplo n.º 7
0
 def test_non_canonical_tagged_version_bump(self):
     self.repo.commit()
     self.repo.tag('1.4')
     self.repo.commit('Sem-Ver: api-break')
     version = packaging._get_version_from_git()
     self.assertThat(version, matchers.StartsWith('2.0.0.dev1'))
Ejemplo n.º 8
0
 def test_tagged_version_has_tag_version(self):
     self.repo.commit()
     self.repo.tag('1.2.3')
     version = packaging._get_version_from_git('1.2.3')
     self.assertEqual('1.2.3', version)
Ejemplo n.º 9
0
 def test_capitalized_headers_partial(self):
     self.repo.commit()
     self.repo.tag('1.2.3')
     self.repo.commit('Sem-ver: api-break')
     version = packaging._get_version_from_git()
     self.assertThat(version, matchers.StartsWith('2.0.0.dev1'))
Ejemplo n.º 10
0
 def test_tagged_version_with_semver_compliant_prerelease(self):
     self.repo.commit()
     self.repo.tag('1.2.3-rc2')
     version = packaging._get_version_from_git()
     self.assertEqual('1.2.3.0rc2', version)
Ejemplo n.º 11
0
 def test_untagged_version_after_semver_compliant_prerelease_tag(self):
     self.repo.commit()
     self.repo.tag('1.2.3-rc2')
     self.repo.commit()
     version = packaging._get_version_from_git()
     self.assertEqual('1.2.3.0rc3.dev1', version)
Ejemplo n.º 12
0
 def test_untagged_version_has_dev_version_postversion(self):
     self.repo.commit()
     self.repo.tag('1.2.3')
     self.repo.commit()
     version = packaging._get_version_from_git()
     self.assertThat(version, matchers.StartsWith('1.2.4.dev1.g'))
Ejemplo n.º 13
0
 def test_capitalized_headers(self):
     self.repo.commit()
     self.repo.tag("1.2.3")
     self.repo.commit("Sem-Ver: api-break")
     version = packaging._get_version_from_git()
     self.assertThat(version, matchers.StartsWith("2.0.0.dev1"))
Ejemplo n.º 14
0
 def test_capitalized_headers(self):
     self.repo.commit()
     self.repo.tag('1.2.3')
     self.repo.commit('Sem-Ver: api-break')
     version = packaging._get_version_from_git()
     self.assertThat(version, matchers.StartsWith('2.0.0.dev1'))
Ejemplo n.º 15
0
 def test_untagged_version_after_rc_has_dev_version_preversion(self):
     self.repo.commit()
     self.repo.tag('1.2.3.0a1')
     self.repo.commit()
     version = packaging._get_version_from_git('1.2.3')
     self.assertThat(version, matchers.StartsWith('1.2.3.0a2.dev1'))
Ejemplo n.º 16
0
 def test_untagged_version_major_bump(self):
     self.repo.commit()
     self.repo.tag('1.2.3')
     self.repo.commit('sem-ver: api-break')
     version = packaging._get_version_from_git()
     self.assertThat(version, matchers.StartsWith('2.0.0.dev1'))
Ejemplo n.º 17
0
 def test_untagged_version_minor_bump(self):
     self.repo.commit()
     self.repo.tag('1.2.3')
     self.repo.commit('sem-ver: deprecation')
     version = packaging._get_version_from_git()
     self.assertThat(version, matchers.StartsWith('1.3.0.dev1'))
Ejemplo n.º 18
0
 def test_tagged_version_has_tag_version(self):
     self.repo.commit()
     self.repo.tag('1.2.3')
     version = packaging._get_version_from_git('1.2.3')
     self.assertEqual('1.2.3', version)
Ejemplo n.º 19
0
 def test_untagged_version_major_bump(self):
     self.repo.commit()
     self.repo.tag('1.2.3')
     self.repo.commit('sem-ver: api-break')
     version = packaging._get_version_from_git()
     self.assertThat(version, matchers.StartsWith('2.0.0.dev1'))
Ejemplo n.º 20
0
 def test_untagged_version_after_rc_has_dev_version_preversion(self):
     self.repo.commit()
     self.repo.tag('1.2.3.0a1')
     self.repo.commit()
     version = packaging._get_version_from_git('1.2.3')
     self.assertThat(version, matchers.StartsWith('1.2.3.0a2.dev1'))
Ejemplo n.º 21
0
 def test_untagged_version_has_dev_version_postversion(self):
     self.repo.commit()
     self.repo.tag('1.2.3')
     self.repo.commit()
     version = packaging._get_version_from_git()
     self.assertThat(version, matchers.StartsWith('1.2.4.dev1.g'))
Ejemplo n.º 22
0
 def test_untagged_version_after_pre_has_dev_version_preversion(self):
     self.repo.commit()
     self.repo.tag("1.2.3.0a1")
     self.repo.commit()
     version = packaging._get_version_from_git("1.2.5")
     self.assertThat(version, matchers.StartsWith("1.2.5.dev1"))
Ejemplo n.º 23
0
 def test_non_canonical_tagged_version_bump(self):
     self.repo.commit()
     self.repo.tag('1.4')
     self.repo.commit('Sem-Ver: api-break')
     version = packaging._get_version_from_git()
     self.assertThat(version, matchers.StartsWith('2.0.0.dev1'))