summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_signal.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-03-12 15:19:01 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2015-03-12 15:19:01 (GMT)
commit945c82eea3072b41c09dd7c9cdc75a1f24e0ce59 (patch)
treeb4b9df22ef99c26908dc9d1003f74325a4d5d9fd /Lib/test/test_signal.py
parentf7cc3fccadae5f2bb764b16808806b7d1849871b (diff)
downloadcpython-945c82eea3072b41c09dd7c9cdc75a1f24e0ce59.zip
cpython-945c82eea3072b41c09dd7c9cdc75a1f24e0ce59.tar.gz
cpython-945c82eea3072b41c09dd7c9cdc75a1f24e0ce59.tar.bz2
test
Diffstat (limited to 'Lib/test/test_signal.py')
-rw-r--r--Lib/test/test_signal.py17
1 files changed, 10 insertions, 7 deletions
diff --git a/Lib/test/test_signal.py b/Lib/test/test_signal.py
index 774fc80..6ecff9e 100644
--- a/Lib/test/test_signal.py
+++ b/Lib/test/test_signal.py
@@ -419,17 +419,20 @@ class WakeupSignalTests(unittest.TestCase):
TIMEOUT_HALF = 5
signal.alarm(1)
- before_time = time.time()
+
# We attempt to get a signal during the sleep,
# before select is called
- time.sleep(TIMEOUT_FULL)
- mid_time = time.time()
- dt = mid_time - before_time
- if dt >= TIMEOUT_HALF:
- raise Exception("%s >= %s" % (dt, TIMEOUT_HALF))
+ try:
+ select.select([], [], [], TIMEOUT_FULL)
+ except InterruptedError:
+ pass
+ else:
+ raise Exception("select() was not interrupted")
+
+ before_time = time.time()
select.select([read], [], [], TIMEOUT_FULL)
after_time = time.time()
- dt = after_time - mid_time
+ dt = after_time - before_time
if dt >= TIMEOUT_HALF:
raise Exception("%s >= %s" % (dt, TIMEOUT_HALF))
""", signal.SIGALRM)