Fix flakiness in test_socketserver

This commit is contained in:
Antoine Pitrou 2012-04-09 01:16:47 +02:00
parent b0a9c66a49
commit f18d6f3f44
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: