MCPcopy Index your code
hub / github.com/python/cpython / test_Exit

Method test_Exit

Lib/test/test_unittest/test_program.py:147–162  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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()

Callers

nothing calls this directly

Calls 7

getvalueMethod · 0.95
assertInMethod · 0.80
assertEndsWithMethod · 0.80
BufferedWriterClass · 0.70
assertRaisesMethod · 0.45
mainMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected