mirror of https://github.com/python/cpython
Fix flakiness in test_socketserver
This commit is contained in:
commit
0ec2c075a2
|
@ -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:
|
||||
|
|
Loading…
Reference in New Issue