diff options
author | Kristján Valur Jónsson <kristjan@ccpgames.com> | 2012-04-06 14:37:45 (GMT) |
---|---|---|
committer | Kristján Valur Jónsson <kristjan@ccpgames.com> | 2012-04-06 14:37:45 (GMT) |
commit | b2e58185e5ca329b16177ad2095b35adaaafdd91 (patch) | |
tree | ae873949a52a58c3bc4e9e4b7364ce49f1ea1a79 /Lib/test/test_asyncore.py | |
parent | f3be68e0a824d165c37c899ad9674918a870dc45 (diff) | |
download | cpython-b2e58185e5ca329b16177ad2095b35adaaafdd91.zip cpython-b2e58185e5ca329b16177ad2095b35adaaafdd91.tar.gz cpython-b2e58185e5ca329b16177ad2095b35adaaafdd91.tar.bz2 |
Set a time threshold in test_asyncore.capture_server so that tests don't
deadlock if the main thread fails before sending all the data.
Diffstat (limited to 'Lib/test/test_asyncore.py')
-rw-r--r-- | Lib/test/test_asyncore.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/test/test_asyncore.py b/Lib/test/test_asyncore.py index 1123c25..42a2525 100644 --- a/Lib/test/test_asyncore.py +++ b/Lib/test/test_asyncore.py @@ -74,15 +74,16 @@ def capture_server(evt, buf, serv): pass else: n = 200 - while n > 0: - r, w, e = select.select([conn], [], []) + start = time.time() + while n > 0 and time.time() - start < 3.0: + r, w, e = select.select([conn], [], [], 0.1) if r: + n -= 1 data = conn.recv(10) # keep everything except for the newline terminator buf.write(data.replace(b'\n', b'')) if b'\n' in data: break - n -= 1 time.sleep(0.01) conn.close() |