diff options
author | Robert Collins <rbtcollins@hp.com> | 2014-05-18 18:43:58 +1200 |
---|---|---|
committer | Robert Collins <rbtcollins@hp.com> | 2014-05-27 10:40:10 +1200 |
commit | 2e2245c78301ec390601e5bd3b347a3703077be8 (patch) | |
tree | 0adcd1ec0788c7d007972701b5ffe7c5c4db18c3 /pbr/tests/base.py | |
parent | e01b28e4c36d2505555bfd969fa225715c20dbbb (diff) | |
download | pbr-2e2245c78301ec390601e5bd3b347a3703077be8.tar.gz |
Make setUp fail if sdist fails.
Hygiene - fail at the point of failure, not later.
Change-Id: Id0328f1afad5dd2fb4f5ef22e025d60eef1d4e52
Diffstat (limited to 'pbr/tests/base.py')
-rw-r--r-- | pbr/tests/base.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/pbr/tests/base.py b/pbr/tests/base.py index 6c31bc9..c58414e 100644 --- a/pbr/tests/base.py +++ b/pbr/tests/base.py @@ -116,17 +116,20 @@ class BaseTestCase(testtools.TestCase, testresources.ResourcedTestCase): k.startswith('pbr_testpackage.')): del sys.modules[k] - def run_setup(self, *args): - return self._run_cmd(sys.executable, ('setup.py',) + args) + def run_setup(self, *args, **kwargs): + return self._run_cmd(sys.executable, ('setup.py',) + args, **kwargs) - def _run_cmd(self, cmd, args=[]): + def _run_cmd(self, cmd, args=[], allow_fail=True): """Run a command in the root of the test working copy. Runs a command, with the given argument list, in the root of the test working copy--returns the stdout and stderr streams and the exit code from the subprocess. """ - return _run_cmd([cmd] + list(args), cwd=self.package_dir) + result = _run_cmd([cmd] + list(args), cwd=self.package_dir) + if result[2] and not allow_fail: + raise Exception("Command failed retcode=%s" % result[2]) + return result def _run_cmd(args, cwd): |