summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorRobert Collins <robertc@robertcollins.net>2014-11-18 21:40:38 +1300
committerRobert Collins <robertc@robertcollins.net>2014-11-18 21:40:38 +1300
commit71a7491a034459de6ebc6a9c211f6b2bd05345ff (patch)
tree37c91b4d348b6d69e6bec32e1437bda3eaa4928d /python
parent0766afade97149c0e8796c502ae3bbbf872bc6e8 (diff)
downloadsubunit-71a7491a034459de6ebc6a9c211f6b2bd05345ff.tar.gz
Fix tests with testtools 1.2.0 and above.
Import errors don't break execution or listing now in testtools, so to test execution breaking we have to be a little bit more direct.
Diffstat (limited to 'python')
-rw-r--r--python/subunit/tests/test_run.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/python/subunit/tests/test_run.py b/python/subunit/tests/test_run.py
index d92ed04..de9b094 100644
--- a/python/subunit/tests/test_run.py
+++ b/python/subunit/tests/test_run.py
@@ -80,9 +80,14 @@ class TestSubunitTestRunner(TestCase):
self.fail("SystemExit raised")
self.assertThat(bytestream.getvalue(), StartsWith(_b('\xb3')))
+ class ExitingTest(TestCase):
+ def test_exit(self):
+ raise SystemExit(0)
+
def test_exits_nonzero_when_execution_errors(self):
bytestream = io.BytesIO()
stream = io.TextIOWrapper(bytestream, encoding="utf8")
- exc = self.assertRaises(Exception, run.main,
- argv=["progName", "subunit.tests.test_run.TestSubunitTestRunner.MissingTest"],
+ exc = self.assertRaises(SystemExit, run.main,
+ argv=["progName", "subunit.tests.test_run.TestSubunitTestRunner.ExitingTest"],
stdout=stream)
+ self.assertEqual(0, exc.args[0])