Verify that the signal handlers were really called
This commit is contained in:
parent
c173b488dc
commit
ec3c5e396e
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue