diff options
Diffstat (limited to 'pbr/tests/test_core.py')
-rw-r--r-- | pbr/tests/test_core.py | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/pbr/tests/test_core.py b/pbr/tests/test_core.py index f24e5cb..f8e5989 100644 --- a/pbr/tests/test_core.py +++ b/pbr/tests/test_core.py @@ -42,6 +42,8 @@ import glob import os import tarfile +import fixtures + from pbr import tests @@ -73,3 +75,50 @@ class TestCore(tests.BaseTestCase): names = ['/'.join(p.split('/')[1:]) for p in tf.getnames()] assert 'extra-file.txt' in names + + def test_console_script_install(self): + """Test that we install a non-pkg-resources console script.""" + + if os.name == 'nt': + self.skipTest('Windows support is passthrough') + + stdout, _, return_code = self.run_setup( + 'install_scripts', '--install-dir=%s' % self.temp_dir) + + self.assertIn( + 'Installing pbr_test_cmd script to %s' % self.temp_dir, + stdout) + self.assertNotIn( + 'pkg_resources', + open(os.path.join(self.temp_dir, 'pbr_test_cmd'), 'r').read()) + + self.useFixture( + fixtures.EnvironmentVariable('PYTHONPATH', '.')) + + stdout, _, return_code = self._run_cmd( + os.path.join(self.temp_dir, 'pbr_test_cmd')) + self.assertIn("PBR", stdout) + + def test_console_script_develop(self): + """Test that we develop a non-pkg-resources console script.""" + + if os.name == 'nt': + self.skipTest('Windows support is passthrough') + + self.useFixture( + fixtures.EnvironmentVariable( + 'PYTHONPATH', ".:%s" % self.temp_dir)) + + stdout, _, return_code = self.run_setup( + 'develop', '--install-dir=%s' % self.temp_dir) + + self.assertIn( + 'Installing pbr_test_cmd script to %s' % self.temp_dir, + stdout) + self.assertNotIn( + 'pkg_resources', + open(os.path.join(self.temp_dir, 'pbr_test_cmd'), 'r').read()) + + stdout, _, return_code = self._run_cmd( + os.path.join(self.temp_dir, 'pbr_test_cmd')) + self.assertIn("PBR", stdout) |