MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_Exit

Method test_Exit

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected