From 71a7491a034459de6ebc6a9c211f6b2bd05345ff Mon Sep 17 00:00:00 2001 From: Robert Collins Date: Tue, 18 Nov 2014 21:40:38 +1300 Subject: 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. --- NEWS | 6 ++++++ python/subunit/tests/test_run.py | 9 +++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index 119d2ee..60028d9 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,12 @@ subunit release notes NEXT (In development) --------------------- +BUGFIXES +~~~~~~~~ + +* Tests have been fixed with testtools 1.2.0 and above. + (Robert Collins) + 0.0.21 ------ 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]) -- cgit v1.2.1