diff options
| author | Neal Norwitz <nnorwitz@gmail.com> | 2006-07-30 19:18:38 (GMT) | 
|---|---|---|
| committer | Neal Norwitz <nnorwitz@gmail.com> | 2006-07-30 19:18:38 (GMT) | 
| commit | ec3c5e396e58b19fdd4e4bd722eb56d431ca38af (patch) | |
| tree | ee1bd1d158d840f9a58c06028b3873702171b66f /Lib/test/test_signal.py | |
| parent | c173b488dcf496e9a09024fbcd1104d72f71d226 (diff) | |
| download | cpython-ec3c5e396e58b19fdd4e4bd722eb56d431ca38af.zip cpython-ec3c5e396e58b19fdd4e4bd722eb56d431ca38af.tar.gz cpython-ec3c5e396e58b19fdd4e4bd722eb56d431ca38af.tar.bz2  | |
Verify that the signal handlers were really called
Diffstat (limited to 'Lib/test/test_signal.py')
| -rw-r--r-- | Lib/test/test_signal.py | 12 | 
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py index f7fcb04..8dff1f5 100644 --- a/Lib/test/test_signal.py +++ b/Lib/test/test_signal.py @@ -25,7 +25,11 @@ script = """   ) &  """ % vars() +a_called = b_called = False +  def handlerA(*args): +    global a_called +    a_called = True      if verbose:          print "handlerA", args @@ -33,6 +37,8 @@ class HandlerBCalled(Exception):      pass  def handlerB(*args): +    global b_called +    b_called = True      if verbose:          print "handlerB", args      raise HandlerBCalled, args @@ -88,6 +94,12 @@ try:          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)  | 
