summaryrefslogtreecommitdiff
path: root/testrepository
diff options
context:
space:
mode:
Diffstat (limited to 'testrepository')
-rw-r--r--testrepository/testcommand.py5
-rw-r--r--testrepository/tests/test_testcommand.py9
2 files changed, 13 insertions, 1 deletions
diff --git a/testrepository/testcommand.py b/testrepository/testcommand.py
index 2cb4d50..267f4ef 100644
--- a/testrepository/testcommand.py
+++ b/testrepository/testcommand.py
@@ -293,7 +293,10 @@ class TestListingFixture(Fixture):
run_proc = self.ui.subprocess_Popen(list_cmd, shell=True,
stdout=subprocess.PIPE, stdin=subprocess.PIPE)
out, err = run_proc.communicate()
- # Should we raise on non-zero exit?
+ if run_proc.returncode != 0:
+ raise ValueError(
+ "Non-zero exit code (%d) from test listing."
+ " stdout=%r, stderr=%r" % (run_proc.returncode, out, err))
ids = parse_enumeration(out)
return ids
finally:
diff --git a/testrepository/tests/test_testcommand.py b/testrepository/tests/test_testcommand.py
index 605d490..cdaeaa8 100644
--- a/testrepository/tests/test_testcommand.py
+++ b/testrepository/tests/test_testcommand.py
@@ -321,6 +321,15 @@ class TestTestCommand(ResourcedTestCase):
fixture = self.useFixture(command.get_run_command())
self.assertEqual(set(['returned', 'ids']), set(fixture.list_tests()))
+ def test_list_tests_nonzero_exit(self):
+ ui, command = self.get_test_ui_and_cmd()
+ ui.proc_results = [1]
+ self.set_config(
+ '[DEFAULT]\ntest_command=foo $LISTOPT $IDLIST\ntest_id_list_default=whoo yea\n'
+ 'test_list_option=--list\n')
+ fixture = self.useFixture(command.get_run_command())
+ self.assertThat(lambda:fixture.list_tests(), raises(ValueError))
+
def test_partition_tests_smoke(self):
repo = memory.RepositoryFactory().initialise('memory:')
# Seed with 1 slow and 2 tests making up 2/3 the time.