diff options
author | Monty Taylor <mordred@inaugust.com> | 2014-12-18 15:09:33 -0800 |
---|---|---|
committer | Jeremy Stanley <fungi@yuggoth.org> | 2014-12-21 22:20:49 +0000 |
commit | c01b8dae1e5ad91d30756140d9b591818444db2d (patch) | |
tree | 520bfbc3314e71ccc06e1d72aa2b9b6789607490 /pbr/tests/test_packaging.py | |
parent | 1f5c9f71f99944ecf6e120efdb677f44fbe3b654 (diff) | |
download | pbr-c01b8dae1e5ad91d30756140d9b591818444db2d.tar.gz |
Port in git sha changes from 0.10 line
Stop including git sha in version strings
We include it in pbr.json now. Including it is contentious in the world
of python, and it's up for debate as to whether or not it provides value.
Write and read more complex git sha info
Instead of encoding the git sha into the version string, add it to
a metadata file. This will allow us to get out of the business of
arguing with pip and setuptools about version info. In order to make
this really nice, provide a command line utility called "pbr" that has
subcommands to print out the metadata that we're now including in the
egg-info dir.
Only import sphinx during hook processing
When pbr is imported to handle writing the egg_info file because of
the entry point, it's causing sphinx to get imported. This has a
cascading effect once docutils is trying to be installed on a system
with pbr installed. If some of the imports fail along the way, allow
pbr to continue usefully but without the Sphinx extensions
available. Eventually, when everything is installed, those
extensions will work again when the commands for build_sphinx, etc.
are run separately.
Also slip in a change to reorder the default list of environments
run by tox so the testr database is created using a dbm format
available to all python versions.
Integration test PBR commits
Make sure that if a PBR commit is being tested then we install and
use that source rather than the latest PBR release.
Change-Id: Ie121e795be2eef30822daaa5fe8ab1c2315577ae
(cherry picked from commit 65f4fafd907a16ea1952ab7072676db2e9e0c51d)
(cherry picked from commit cd7da23937b66fea3ec42fa2f5a128f363a97e7e)
Closes-Bug: #1403510
Co-Authored-By: Clark Boylan <clark.boylan@gmail.com>
Co-Authored-By: Doug Hellmann <doug@doughellmann.com>
Co-Authored-By: Jeremy Stanley <fungi@yuggoth.org>
Diffstat (limited to 'pbr/tests/test_packaging.py')
-rw-r--r-- | pbr/tests/test_packaging.py | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/pbr/tests/test_packaging.py b/pbr/tests/test_packaging.py index 0fdc5bb..948255d 100644 --- a/pbr/tests/test_packaging.py +++ b/pbr/tests/test_packaging.py @@ -47,6 +47,7 @@ import mock import testscenarios from testtools import matchers +from pbr import git from pbr import packaging from pbr.tests import base @@ -189,16 +190,16 @@ class TestPackagingInPlainDirectory(base.BaseTestCase): class TestPresenceOfGit(base.BaseTestCase): def testGitIsInstalled(self): - with mock.patch.object(packaging, + with mock.patch.object(git, '_run_shell_command') as _command: _command.return_value = 'git version 1.8.4.1' - self.assertEqual(True, packaging._git_is_installed()) + self.assertEqual(True, git._git_is_installed()) def testGitIsNotInstalled(self): - with mock.patch.object(packaging, + with mock.patch.object(git, '_run_shell_command') as _command: _command.side_effect = OSError - self.assertEqual(False, packaging._git_is_installed()) + self.assertEqual(False, git._git_is_installed()) class TestNestedRequirements(base.BaseTestCase): @@ -259,14 +260,14 @@ class TestVersions(base.BaseTestCase): 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.g')) + self.assertThat(version, matchers.StartsWith('2.0.0.dev1')) 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.g')) + self.assertThat(version, matchers.StartsWith('2.0.0.dev1')) def test_tagged_version_has_tag_version(self): self.repo.commit() @@ -279,28 +280,28 @@ class TestVersions(base.BaseTestCase): 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')) + self.assertThat(version, matchers.StartsWith('1.2.4.dev1')) 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.g')) + self.assertThat(version, matchers.StartsWith('1.3.0.dev1')) 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.g')) + self.assertThat(version, matchers.StartsWith('2.0.0.dev1')) def test_untagged_version_has_dev_version_preversion(self): self.repo.commit() self.repo.tag('1.2.3') self.repo.commit() version = packaging._get_version_from_git('1.2.5') - self.assertThat(version, matchers.StartsWith('1.2.5.dev1.g')) + self.assertThat(version, matchers.StartsWith('1.2.5.dev1')) def test_preversion_too_low_simple(self): # That is, the target version is either already released or not high @@ -359,32 +360,32 @@ class TestVersions(base.BaseTestCase): # 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')) + 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.g')) + 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.g')) + 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.g')) + 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.dev1.g')) + self.assertThat(version, matchers.StartsWith('1.2.4.dev1')) def test_valid_tag_honoured(self): # Fix for bug 1370608 - we converted any target into a 'dev version' |