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

Method testTwoResults

Lib/test/test_unittest/test_break.py:124–146  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

122
123
124 def testTwoResults(self):
125 def test_function():
126 unittest.installHandler()
127
128 result = unittest.TestResult()
129 unittest.registerResult(result)
130 new_handler = signal.getsignal(signal.SIGINT)
131
132 result2 = unittest.TestResult()
133 unittest.registerResult(result2)
134 self.assertEqual(signal.getsignal(signal.SIGINT), new_handler)
135
136 result3 = unittest.TestResult()
137
138 try:
139 os.kill(os.getpid(), signal.SIGINT)
140 except KeyboardInterrupt:
141 self.fail("KeyboardInterrupt not handled")
142
143 self.assertTrue(result.shouldStop)
144 self.assertTrue(result2.shouldStop)
145 self.assertFalse(result3.shouldStop)
146 self.withRepeats(test_function)
147
148
149 def testHandlerReplacedButCalled(self):

Callers

nothing calls this directly

Calls 1

withRepeatsMethod · 0.95

Tested by

no test coverage detected