(self)
| 97 | self.withRepeats(test_function) |
| 98 | |
| 99 | def testSecondInterrupt(self): |
| 100 | # Can't use skipIf decorator because the signal handler may have |
| 101 | # been changed after defining this method. |
| 102 | if signal.getsignal(signal.SIGINT) == signal.SIG_IGN: |
| 103 | self.skipTest("test requires SIGINT to not be ignored") |
| 104 | |
| 105 | def test(result): |
| 106 | pid = os.getpid() |
| 107 | os.kill(pid, signal.SIGINT) |
| 108 | result.breakCaught = True |
| 109 | self.assertTrue(result.shouldStop) |
| 110 | os.kill(pid, signal.SIGINT) |
| 111 | self.fail("Second KeyboardInterrupt not raised") |
| 112 | |
| 113 | def test_function(): |
| 114 | result = unittest.TestResult() |
| 115 | unittest.installHandler() |
| 116 | unittest.registerResult(result) |
| 117 | |
| 118 | with self.assertRaises(KeyboardInterrupt): |
| 119 | test(result) |
| 120 | self.assertTrue(result.breakCaught) |
| 121 | self.withRepeats(test_function) |
| 122 | |
| 123 | |
| 124 | def testTwoResults(self): |
nothing calls this directly
no test coverage detected