def testTwoResults(self):
unittest2.installHandler()
result = unittest2.TestResult()
unittest2.registerResult(result)
new_handler = signal.getsignal(signal.SIGINT)
result2 = unittest2.TestResult()
unittest2.registerResult(result2)
self.assertEqual(signal.getsignal(signal.SIGINT), new_handler)
result3 = unittest2.TestResult()
def test(result):
pid = os.getpid()
os.kill(pid, signal.SIGINT)
try:
test(result)
except KeyboardInterrupt:
self.fail("KeyboardInterrupt not handled")
self.assertTrue(result.shouldStop)
self.assertTrue(result2.shouldStop)
self.assertFalse(result3.shouldStop)
test_break.py 文件源码
python
阅读 25
收藏 0
点赞 0
评论 0
评论列表
文章目录