diff options
author | Monty Taylor <mordred@inaugust.com> | 2013-05-25 07:58:44 +0200 |
---|---|---|
committer | Monty Taylor <mordred@inaugust.com> | 2013-08-04 11:30:32 -0400 |
commit | d26d43014b9202437d276be298539efddbc914e3 (patch) | |
tree | 68d51259e1df7651ecedae8daf2c6af7b2cd2eb7 /pbr/tests/test_core.py | |
parent | 344187c8a72125a2abcec02f5e17846d8357ec99 (diff) | |
download | pbr-d26d43014b9202437d276be298539efddbc914e3.tar.gz |
Replace setuptools_git with a smarter approach
Implement a local egg_info command that only re-generates the
SOURCES.txt file when we need to. That is:
- If there is no SOURCES.txt, make one
- If we have run the sdist command, make one
Otherwise, leave well enough alone.
Also, skip doing any git processing if SKIP_GIT_SDIST is specified.
This should mean that consumers of our tarballs should not get screwed
by the need to inject git processing into the sdist.
Change-Id: I163b1c153d030e79b120600a2890edeb49e1fa90
Diffstat (limited to 'pbr/tests/test_core.py')
-rw-r--r-- | pbr/tests/test_core.py | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/pbr/tests/test_core.py b/pbr/tests/test_core.py index a7376eb..dd21e6f 100644 --- a/pbr/tests/test_core.py +++ b/pbr/tests/test_core.py @@ -90,7 +90,7 @@ class TestCore(tests.BaseTestCase): tf = tarfile.open(tf_path) names = ['/'.join(p.split('/')[1:]) for p in tf.getnames()] - assert 'extra-file.txt' in names + self.assertIn('extra-file.txt', names) def test_console_script_install(self): """Test that we install a non-pkg-resources console script.""" @@ -120,3 +120,28 @@ class TestCore(tests.BaseTestCase): 'develop', '--install-dir=%s' % self.temp_dir) self.check_script_install(stdout) + + +class TestGitSDist(tests.BaseTestCase): + + def setUp(self): + super(TestGitSDist, self).setUp() + + stdout, _, return_code = self._run_cmd('git', ('init',)) + if return_code: + self.skipTest("git not installed") + + stdout, _, return_code = self._run_cmd('git', ('add', '.')) + stdout, _, return_code = self._run_cmd( + 'git', ('commit', '-m', 'Turn this into a git repo')) + + stdout, _, return_code = self.run_setup('sdist', '--formats=gztar') + + def test_sdist_git_extra_files(self): + """Test that extra files found in git are correctly added.""" + # There can be only one + tf_path = glob.glob(os.path.join('dist', '*.tar.gz'))[0] + tf = tarfile.open(tf_path) + names = ['/'.join(p.split('/')[1:]) for p in tf.getnames()] + + self.assertIn('git-extra-file.txt', names) |