mirror of
https://github.com/python/cpython.git
synced 2025-10-21 14:12:27 +00:00
Fix flakiness in test_socketserver
This commit is contained in:
parent
b0a9c66a49
commit
f18d6f3f44
1 changed files with 4 additions and 1 deletions
|
@ -34,8 +34,11 @@ def signal_alarm(n):
|
||||||
if hasattr(signal, 'alarm'):
|
if hasattr(signal, 'alarm'):
|
||||||
signal.alarm(n)
|
signal.alarm(n)
|
||||||
|
|
||||||
|
# Remember real select() to avoid interferences with mocking
|
||||||
|
_real_select = select.select
|
||||||
|
|
||||||
def receive(sock, n, timeout=20):
|
def receive(sock, n, timeout=20):
|
||||||
r, w, x = select.select([sock], [], [], timeout)
|
r, w, x = _real_select([sock], [], [], timeout)
|
||||||
if sock in r:
|
if sock in r:
|
||||||
return sock.recv(n)
|
return sock.recv(n)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue