def testInterruptCaught(self):
        default_handler = signal.getsignal(signal.SIGINT)

        result = unittest.TestResult()
        unittest.installHandler()
        unittest.registerResult(result)

        self.assertNotEqual(signal.getsignal(signal.SIGINT), default_handler)

        def test(result):
            pid = os.getpid()
            os.kill(pid, signal.SIGINT)
            result.breakCaught = True
            self.assertTrue(result.shouldStop)

        try:
            test(result)
        except __HOLE__:
            self.fail("KeyboardInterrupt not handled")
        self.assertTrue(result.breakCaught)
dataset/ETHPy150Open azoft-dev-team/imagrium/env/Lib/unittest/test/test_break.py/TestBreak.testInterruptCaught