[Python-checkins] r50988 - python/trunk/Lib/test/test_signal.py

neal.norwitz python-checkins at python.org
Sun Jul 30 21:18:38 CEST 2006


Author: neal.norwitz
Date: Sun Jul 30 21:18:38 2006
New Revision: 50988

Modified:
   python/trunk/Lib/test/test_signal.py
Log:
Verify that the signal handlers were really called

Modified: python/trunk/Lib/test/test_signal.py
==============================================================================
--- python/trunk/Lib/test/test_signal.py	(original)
+++ python/trunk/Lib/test/test_signal.py	Sun Jul 30 21:18:38 2006
@@ -25,7 +25,11 @@
  ) &
 """ % vars()
 
+a_called = b_called = False
+
 def handlerA(*args):
+    global a_called
+    a_called = True
     if verbose:
         print "handlerA", args
 
@@ -33,6 +37,8 @@
     pass
 
 def handlerB(*args):
+    global b_called
+    b_called = True
     if verbose:
         print "handlerB", args
     raise HandlerBCalled, args
@@ -88,6 +94,12 @@
         if verbose:
             print "KeyboardInterrupt (assume the alarm() went off)"
 
+    if not a_called:
+        print 'HandlerA not called'
+
+    if not b_called:
+        print 'HandlerB not called'
+
 finally:
     signal.signal(signal.SIGHUP, hup)
     signal.signal(signal.SIGUSR1, usr1)


More information about the Python-checkins mailing list