diff options
Diffstat (limited to 'Lib/test/test_signal.py')
-rw-r--r-- | Lib/test/test_signal.py | 17 |
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) |