diff options
Diffstat (limited to 'pbr/tests')
-rw-r--r-- | pbr/tests/test_core.py | 27 | ||||
-rw-r--r-- | pbr/tests/testpackage/git-extra-file.txt | 0 |
2 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) diff --git a/pbr/tests/testpackage/git-extra-file.txt b/pbr/tests/testpackage/git-extra-file.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/pbr/tests/testpackage/git-extra-file.txt |