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.
This commit is contained in:
parent
52dad0f4f5
commit
7c203ff76e
6
NEWS
6
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
|
||||
------
|
||||
|
||||
|
|
|
@ -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])
|
||||
|
|
Loading…
Reference in New Issue