Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f18d6f3

Browse files
committed
Fix flakiness in test_socketserver
1 parent b0a9c66 commit f18d6f3

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

Lib/test/test_socketserver.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,11 @@ def signal_alarm(n):
3434
if hasattr(signal, 'alarm'):
3535
signal.alarm(n)
3636

37+
# Remember real select() to avoid interferences with mocking
38+
_real_select = select.select
39+
3740
def receive(sock, n, timeout=20):
38-
r, w, x = select.select([sock], [], [], timeout)
41+
r, w, x = _real_select([sock], [], [], timeout)
3942
if sock in r:
4043
return sock.recv(n)
4144
else:

0 commit comments

Comments
 (0)