diff -r 97e01e107591 Lib/unittest/case.py --- a/Lib/unittest/case.py Sun Mar 08 15:29:39 2015 -0700 +++ b/Lib/unittest/case.py Mon Mar 09 10:10:07 2015 +0100 @@ -566,9 +566,15 @@ class TestCase(object): expecting_failure = getattr(testMethod, "__unittest_expecting_failure__", False) outcome = _Outcome(result) + + def sig_noop(*args): + pass + old_handler = signal.signal(signal.SIGALRM, sig_noop) try: self._outcome = outcome + signal.setitimer(signal.ITIMER_REAL, 0.1, 0.001) + with outcome.testPartExecutor(self): self.setUp() if outcome.success: @@ -593,6 +599,9 @@ class TestCase(object): result.addSuccess(self) return result finally: + signal.alarm(0) + signal.signal(signal.SIGALRM, old_handler) + result.stopTest(self) if orig_result is None: stopTestRun = getattr(result, 'stopTestRun', None)