Kaydet (Commit) 9730bcb4 authored tarafından Neal Norwitz's avatar Neal Norwitz

Test getsignal() and some error conditions

üst cd3e219c
# Test the signal module
from test.test_support import verbose, TestSkipped, TestFailed
from test.test_support import verbose, TestSkipped, TestFailed, vereq
import signal
import os, sys, time
......@@ -43,6 +43,28 @@ usr1 = signal.signal(signal.SIGUSR1, handlerB)
usr2 = signal.signal(signal.SIGUSR2, signal.SIG_IGN)
alrm = signal.signal(signal.SIGALRM, signal.default_int_handler)
vereq(signal.getsignal(signal.SIGHUP), handlerA)
vereq(signal.getsignal(signal.SIGUSR1), handlerB)
vereq(signal.getsignal(signal.SIGUSR2), signal.SIG_IGN)
try:
signal.signal(4242, handlerB)
raise TestFailed, 'expected ValueError for invalid signal # to signal()'
except ValueError:
pass
try:
signal.getsignal(4242)
raise TestFailed, 'expected ValueError for invalid signal # to getsignal()'
except ValueError:
pass
try:
signal.signal(signal.SIGUSR1, None)
raise TestFailed, 'expected TypeError for non-callable'
except TypeError:
pass
try:
os.system(script)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment