mirror of
https://github.com/python/cpython.git
synced 2025-10-17 04:08:28 +00:00
test
This commit is contained in:
parent
f7cc3fccad
commit
945c82eea3
4 changed files with 102 additions and 60 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue