[issue12625] sporadic test_unittest failure

Charles-François Natali report at bugs.python.org
Sun Jul 24 01:00:49 CEST 2011


Charles-François Natali <neologix at free.fr> added the comment:

Looks similar to issue #8263, which is in turn similar to #12469 (see
http://bugs.python.org/issue12469#msg139620 and
http://bugs.python.org/issue12469#msg139626 for original explanations):
normally, pending signals are checked when the process returns to
user-space, so a code like:

os.kill(os.getpid(), signum)
self.assertTrue(signum's handler called)

will succeed, because the signal is delivered before the kill()
syscall returns (it's actually required by POSIX), and the Python
signal handler will be called from the main eval loop before the assertion
test.
But if the signal isn't delivered right away (on FreeBSD6, it happens
only after a thread has been created, which explains #12469 and
probably #8263), then this check can fail (the signal will be
delivered typically when the next syscall returns, or at the next
timer interrupt, which could be after the test).

So I'd say the easier solution is to skip this test on OpenSolaris,
like it's done on FreeBSD6 since issue #8263.
Patch attached.

----------
keywords: +patch
Added file: http://bugs.python.org/file22736/indiana_signal.diff

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue12625>
_______________________________________
-------------- next part --------------
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 00:57:04 2011 +0200
@@ -9,9 +9,9 @@
 
 
 @unittest.skipUnless(hasattr(os, 'kill'), "Test requires os.kill")
- at unittest.skipIf(sys.platform =="win32", "Test cannot run on Windows")
- at unittest.skipIf(sys.platform == 'freebsd6', "Test kills regrtest on freebsd6 "
-    "if threads have been used")
+ at unittest.skipIf(sys.platform == 'win32', "Test cannot run on Windows")
+ at unittest.skipIf(sys.platform == 'freebsd6', "due to known OS bug")
+ at unittest.skipIf(sys.platform.startswith('sunos'), "due to known OS bug")
 class TestBreak(unittest.TestCase):
 
     def setUp(self):


More information about the Python-bugs-list mailing list