summaryrefslogtreecommitdiff
path: root/python/subunit
diff options
context:
space:
mode:
authorRobert Collins <robertc@robertcollins.net>2014-11-18 21:12:38 +1300
committerRobert Collins <robertc@robertcollins.net>2014-11-18 21:40:38 +1300
commit7c203ff76e7ab83d954cfd6ea1cb4d75f9881823 (patch)
tree37c91b4d348b6d69e6bec32e1437bda3eaa4928d /python/subunit
parent52dad0f4f5625468c8072bd8b1c3925676558562 (diff)
downloadsubunit-git-7c203ff76e7ab83d954cfd6ea1cb4d75f9881823.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/subunit')
-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])