Skip to content

Commit a2c877c

Browse files
authored
bpo-30106: Fix test_asyncore.test_quick_connect() (#1234)
test_quick_connect() runs a thread up to 50 seconds, whereas the socket is connected in 0.2 second and then the thread is expected to end in less than 3 second. On Linux, the thread ends quickly because select() seems to always return quickly. On FreeBSD, sometimes select() fails with timeout and so the thread runs much longer than expected. Fix the thread timeout to fix a race condition in the test.
1 parent 35f3d24 commit a2c877c

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

Lib/test/test_asyncore.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -781,8 +781,9 @@ def test_quick_connect(self):
781781
self.skipTest("test specific to AF_INET and AF_INET6")
782782

783783
server = BaseServer(self.family, self.addr)
784+
# run the thread 500 ms: the socket should be connected in 200 ms
784785
t = threading.Thread(target=lambda: asyncore.loop(timeout=0.1,
785-
count=500))
786+
count=5))
786787
t.start()
787788
try:
788789
with socket.socket(self.family, socket.SOCK_STREAM) as s:

0 commit comments

Comments
 (0)