Skip to content

Commit c4cb673

Browse files
committed
Give the start_tls() connection_lost waits their own support timeouts
Wait for on_con_lost with LOOPBACK_TIMEOUT, shorter than the SHORT_TIMEOUT wrapping the whole client, so a missing connection_lost() fails at that line. Use SHORT_TIMEOUT instead of a hard-coded 10 in the streams test.
1 parent f3434d8 commit c4cb673

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

‎Lib/test/test_asyncio/test_sslproto.py‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -633,7 +633,8 @@ async def client(addr):
633633
self.loop.start_tls(tr, proto, client_context),
634634
0.5)
635635

636-
self.assertIsNone(await on_con_lost)
636+
self.assertIsNone(
637+
await asyncio.wait_for(on_con_lost, support.LOOPBACK_TIMEOUT))
637638

638639
with self.tcp_server(serve, timeout=self.TIMEOUT) as srv:
639640
self.loop.run_until_complete(

‎Lib/test/test_asyncio/test_streams.py‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import asyncio
1616
from test.test_asyncio import utils as test_utils
17+
from test import support
1718
from test.support import socket_helper
1819

1920

@@ -878,7 +879,8 @@ async def server_handler(client_reader, client_writer):
878879
ssl_handshake_timeout=0.1)
879880
client_writer.close()
880881
with self.assertRaises(ConnectionAbortedError):
881-
await asyncio.wait_for(client_writer.wait_closed(), 10)
882+
await asyncio.wait_for(client_writer.wait_closed(),
883+
support.SHORT_TIMEOUT)
882884
handler_done.set()
883885

884886
async def client(addr):
@@ -899,7 +901,8 @@ async def run_test():
899901
server_addr = server.sockets[0].getsockname()
900902

901903
await client(server_addr)
902-
await asyncio.wait_for(handler_done.wait(), 10)
904+
await asyncio.wait_for(handler_done.wait(),
905+
support.SHORT_TIMEOUT)
903906
server.close()
904907
await server.wait_closed()
905908

0 commit comments

Comments
 (0)