(self)
| 145 | self.assertEndsWith(out, expected) |
| 146 | |
| 147 | def test_Exit(self): |
| 148 | stream = BufferedWriter() |
| 149 | with self.assertRaises(SystemExit) as cm: |
| 150 | unittest.main( |
| 151 | argv=["foobar"], |
| 152 | testRunner=unittest.TextTestRunner(stream=stream), |
| 153 | exit=True, |
| 154 | testLoader=self.TestLoader(self.FooBar)) |
| 155 | self.assertEqual(cm.exception.code, 1) |
| 156 | out = stream.getvalue() |
| 157 | self.assertIn('\nFAIL: testFail ', out) |
| 158 | self.assertIn('\nERROR: testError ', out) |
| 159 | self.assertIn('\nUNEXPECTED SUCCESS: testUnexpectedSuccess ', out) |
| 160 | expected = ('\n\nFAILED (failures=1, errors=1, skipped=1, ' |
| 161 | 'expected failures=1, unexpected successes=1)\n') |
| 162 | self.assertEndsWith(out, expected) |
| 163 | |
| 164 | def test_ExitAsDefault(self): |
| 165 | stream = BufferedWriter() |
nothing calls this directly
no test coverage detected