diff options
author | Robert Collins <robertc@robertcollins.net> | 2014-11-18 21:12:38 +1300 |
---|---|---|
committer | Robert Collins <robertc@robertcollins.net> | 2014-11-18 21:40:38 +1300 |
commit | 7c203ff76e7ab83d954cfd6ea1cb4d75f9881823 (patch) | |
tree | 37c91b4d348b6d69e6bec32e1437bda3eaa4928d /python/subunit | |
parent | 52dad0f4f5625468c8072bd8b1c3925676558562 (diff) | |
download | subunit-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.py | 9 |
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]) |