Fix flakiness in test_socketserver

This commit is contained in:
Antoine Pitrou 2012-04-09 01:18:07 +02:00
commit 0ec2c075a2
1 changed files with 4 additions and 1 deletions

View File

@ -34,8 +34,11 @@ def signal_alarm(n):
if hasattr(signal, 'alarm'):
signal.alarm(n)
# Remember real select() to avoid interferences with mocking
_real_select = select.select
def receive(sock, n, timeout=20):
r, w, x = select.select([sock], [], [], timeout)
r, w, x = _real_select([sock], [], [], timeout)
if sock in r:
return sock.recv(n)
else: