summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_signal.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2011-07-04 23:32:06 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2011-07-04 23:32:06 (GMT)
commit5dd470ef1deacf5bf9ed531c28f60082a94f6bb5 (patch)
tree66b985dace5508b98a03b3a53896d12497c2647e /Lib/test/test_signal.py
parent68757ac8840dbe996735e51047d6b45c77456501 (diff)
downloadcpython-5dd470ef1deacf5bf9ed531c28f60082a94f6bb5.zip
cpython-5dd470ef1deacf5bf9ed531c28f60082a94f6bb5.tar.gz
cpython-5dd470ef1deacf5bf9ed531c28f60082a94f6bb5.tar.bz2
Issue #12469: fix signal order check of test_signal
When signals are unblocked, pending signal ared delivered in the reverse order of their number (also on Linux, not only on FreeBSD 6). Don't sort signals by their number if signals were not blocked (test_signum).
Diffstat (limited to 'Lib/test/test_signal.py')
-rw-r--r--Lib/test/test_signal.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py
index 21113be..c349252 100644
--- a/Lib/test/test_signal.py
+++ b/Lib/test/test_signal.py
@@ -240,10 +240,6 @@ class WakeupSignalTests(unittest.TestCase):
def check_signum(signals):
data = os.read(read, len(signals)+1)
raised = struct.unpack('%uB' % len(data), data)
- if sys.platform == 'freebsd6':
- # when signals are unblocked, FreeBSD 6 delivers signals in the
- # reverse order of their number
- signals = tuple(sorted(signals, reverse=False))
if raised != signals:
raise Exception("%r != %r" % (raised, signals))
@@ -323,6 +319,11 @@ class WakeupSignalTests(unittest.TestCase):
@unittest.skipUnless(hasattr(signal, 'pthread_sigmask'),
'need signal.pthread_sigmask()')
def test_pending(self):
+ signals = (signal.SIGUSR1, signal.SIGUSR2)
+ # when signals are unblocked, pending signal ared delivered in the
+ # reverse order of their number
+ signals = tuple(sorted(signals, reverse=True))
+
self.check_wakeup("""def test():
signum1 = signal.SIGUSR1
signum2 = signal.SIGUSR2
@@ -335,7 +336,7 @@ class WakeupSignalTests(unittest.TestCase):
os.kill(os.getpid(), signum2)
# Unblocking the 2 signals calls the C signal handler twice
signal.pthread_sigmask(signal.SIG_UNBLOCK, (signum1, signum2))
- """, signal.SIGUSR1, signal.SIGUSR2)
+ """, *signals)
@unittest.skipIf(sys.platform == "win32", "Not valid on Windows")