diff -r cda93720c06d Lib/unittest/test/test_break.py --- a/Lib/unittest/test/test_break.py Sat Jul 23 18:15:43 2011 +0200 +++ b/Lib/unittest/test/test_break.py Sun Jul 24 14:23:32 2011 +0200 @@ -10,8 +10,6 @@ @unittest.skipUnless(hasattr(os, 'kill'), "Test requires os.kill") @unittest.skipIf(sys.platform =="win32", "Test cannot run on Windows") -@unittest.skipIf(sys.platform == 'freebsd6', "Test kills regrtest on freebsd6 " - "if threads have been used") class TestBreak(unittest.TestCase): def setUp(self): @@ -29,8 +27,15 @@ self.assertNotEqual(signal.getsignal(signal.SIGINT), default_handler) try: + # When a process sends a signal to itself, POSIX states that the + # signal must be delivered before the kill() syscall returns. Some + # operating systems are known to delay signal delivery in this + # situation (see issues #12625, #8263 and #12469): to force the + # signal's delivery, we make a dummy getpid() syscall (signals are + # typically delivered when the process returns to user-space). pid = os.getpid() os.kill(pid, signal.SIGINT) + os.getpid() except KeyboardInterrupt: self.fail("KeyboardInterrupt not handled") @@ -61,6 +66,7 @@ def test(result): pid = os.getpid() os.kill(pid, signal.SIGINT) + os.getpid() result.breakCaught = True self.assertTrue(result.shouldStop) @@ -79,9 +85,11 @@ def test(result): pid = os.getpid() os.kill(pid, signal.SIGINT) + os.getpid() result.breakCaught = True self.assertTrue(result.shouldStop) os.kill(pid, signal.SIGINT) + os.getpid() self.fail("Second KeyboardInterrupt not raised") try: @@ -109,6 +117,7 @@ def test(result): pid = os.getpid() os.kill(pid, signal.SIGINT) + os.getpid() try: test(result) @@ -134,6 +143,7 @@ try: pid = os.getpid() os.kill(pid, signal.SIGINT) + os.getpid() except KeyboardInterrupt: pass else: @@ -173,6 +183,7 @@ try: pid = os.getpid() os.kill(pid, signal.SIGINT) + os.getpid() except KeyboardInterrupt: pass