summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_threadsignals.py
diff options
context:
space:
mode:
authorMichael W. Hudson <mwh@python.net>2004-08-04 14:22:56 (GMT)
committerMichael W. Hudson <mwh@python.net>2004-08-04 14:22:56 (GMT)
commit574a25127a5e0d21483f3b7432798329b49fe112 (patch)
treee530493f855fc9b7626e1316ebeb07ffe93d971f /Lib/test/test_threadsignals.py
parented0d9c6fbd74802031ce77d7baae06dc27b02e08 (diff)
downloadcpython-574a25127a5e0d21483f3b7432798329b49fe112.zip
cpython-574a25127a5e0d21483f3b7432798329b49fe112.tar.gz
cpython-574a25127a5e0d21483f3b7432798329b49fe112.tar.bz2
To ever run this test "you must import TestSkipped" from the right
place! (can that please be it for silly mistakes in this file? :-) I know I started it, but...). Also, rearrangements to run repeatedly.
Diffstat (limited to 'Lib/test/test_threadsignals.py')
-rw-r--r--Lib/test/test_threadsignals.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/Lib/test/test_threadsignals.py b/Lib/test/test_threadsignals.py
index 778879d..fa58d76 100644
--- a/Lib/test/test_threadsignals.py
+++ b/Lib/test/test_threadsignals.py
@@ -5,15 +5,11 @@ import thread
import signal
import os
import sys
-from test import test_support, TestSkipped
+from test.test_support import run_unittest, TestSkipped
if sys.platform[:3] in ('win', 'os2') or sys.platform=='riscos':
raise TestSkipped, "Can't test signal on %s" % sys.platform
-signal_blackboard = { signal.SIGUSR1 : {'tripped': 0, 'tripped_by': 0 },
- signal.SIGUSR2 : {'tripped': 0, 'tripped_by': 0 },
- signal.SIGALRM : {'tripped': 0, 'tripped_by': 0 } }
-
process_pid = os.getpid()
signalled_all=thread.allocate_lock()
@@ -65,15 +61,22 @@ class ThreadSignals(unittest.TestCase):
self.assertEqual( signal_blackboard[signal.SIGUSR2]['tripped'], 1)
self.assertEqual( signal_blackboard[signal.SIGUSR2]['tripped_by'],
thread.get_ident())
+ signalled_all.release()
def spawnSignallingThread(self):
thread.start_new_thread(send_signals, ())
def test_main():
+ global signal_blackboard
+
+ signal_blackboard = { signal.SIGUSR1 : {'tripped': 0, 'tripped_by': 0 },
+ signal.SIGUSR2 : {'tripped': 0, 'tripped_by': 0 },
+ signal.SIGALRM : {'tripped': 0, 'tripped_by': 0 } }
+
oldsigs = registerSignals((handle_signals, handle_signals, handle_signals))
try:
- test_support.run_unittest(ThreadSignals)
+ run_unittest(ThreadSignals)
finally:
registerSignals(oldsigs)