diff options
author | Jenkins <jenkins@review.openstack.org> | 2014-05-27 12:03:24 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2014-05-27 12:03:24 +0000 |
commit | 8a4017eb5e751187e9c9539f312bc02d5ea93d05 (patch) | |
tree | bd27fbf52bdeb21b29e81f8595a37c2c996749c0 | |
parent | d6bd32eea46447626f338cfd088e34ce6e92ce55 (diff) | |
parent | 2e2245c78301ec390601e5bd3b347a3703077be8 (diff) | |
download | pbr-8a4017eb5e751187e9c9539f312bc02d5ea93d05.tar.gz |
Merge "Make setUp fail if sdist fails."
-rw-r--r-- | pbr/tests/base.py | 11 | ||||
-rw-r--r-- | pbr/tests/test_packaging.py | 9 |
2 files changed, 10 insertions, 10 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): diff --git a/pbr/tests/test_packaging.py b/pbr/tests/test_packaging.py index abcc68d..46dd0d5 100644 --- a/pbr/tests/test_packaging.py +++ b/pbr/tests/test_packaging.py @@ -78,8 +78,7 @@ class TestPackagingInGitRepoWithCommit(base.BaseTestCase): super(TestPackagingInGitRepoWithCommit, self).setUp() repo = self.useFixture(TestRepo(self.package_dir)) repo.commit() - self.run_setup('sdist') - return + self.run_setup('sdist', allow_fail=False) def test_authors(self): # One commit, something should be in the authors list @@ -99,8 +98,7 @@ class TestPackagingInGitRepoWithoutCommit(base.BaseTestCase): def setUp(self): super(TestPackagingInGitRepoWithoutCommit, self).setUp() self.useFixture(TestRepo(self.package_dir)) - self.run_setup('sdist') - return + self.run_setup('sdist', allow_fail=False) def test_authors(self): # No commits, no authors in list @@ -119,8 +117,7 @@ class TestPackagingInPlainDirectory(base.BaseTestCase): def setUp(self): super(TestPackagingInPlainDirectory, self).setUp() - self.run_setup('sdist') - return + self.run_setup('sdist', allow_fail=False) def test_authors(self): # Not a git repo, no AUTHORS file created |