mirror of
https://github.com/python/cpython.git
synced 2025-10-09 16:34:44 +00:00
bpo-34728: Fix asyncio tests to run under "-Werror" (GH-9661)
This commit is contained in:
parent
11c4eaa993
commit
9012a0fb4c
14 changed files with 192 additions and 206 deletions
|
@ -252,7 +252,7 @@ class BaseStartTLS(func_tests.FunctionalTestCaseMixin):
|
|||
self.on_eof.set_result(True)
|
||||
|
||||
async def client(addr):
|
||||
await asyncio.sleep(0.5, loop=self.loop)
|
||||
await asyncio.sleep(0.5)
|
||||
|
||||
on_data = self.loop.create_future()
|
||||
on_eof = self.loop.create_future()
|
||||
|
@ -271,7 +271,7 @@ class BaseStartTLS(func_tests.FunctionalTestCaseMixin):
|
|||
|
||||
with self.tcp_server(serve, timeout=self.TIMEOUT) as srv:
|
||||
self.loop.run_until_complete(
|
||||
asyncio.wait_for(client(srv.addr), loop=self.loop, timeout=10))
|
||||
asyncio.wait_for(client(srv.addr), timeout=10))
|
||||
|
||||
def test_start_tls_client_buf_proto_1(self):
|
||||
HELLO_MSG = b'1' * self.PAYLOAD_SIZE
|
||||
|
@ -332,7 +332,7 @@ class BaseStartTLS(func_tests.FunctionalTestCaseMixin):
|
|||
self.on_eof.set_result(True)
|
||||
|
||||
async def client(addr):
|
||||
await asyncio.sleep(0.5, loop=self.loop)
|
||||
await asyncio.sleep(0.5)
|
||||
|
||||
on_data1 = self.loop.create_future()
|
||||
on_data2 = self.loop.create_future()
|
||||
|
@ -362,7 +362,7 @@ class BaseStartTLS(func_tests.FunctionalTestCaseMixin):
|
|||
with self.tcp_server(serve, timeout=self.TIMEOUT) as srv:
|
||||
self.loop.run_until_complete(
|
||||
asyncio.wait_for(client(srv.addr),
|
||||
loop=self.loop, timeout=self.TIMEOUT))
|
||||
timeout=self.TIMEOUT))
|
||||
|
||||
def test_start_tls_slow_client_cancel(self):
|
||||
HELLO_MSG = b'1' * self.PAYLOAD_SIZE
|
||||
|
@ -403,7 +403,7 @@ class BaseStartTLS(func_tests.FunctionalTestCaseMixin):
|
|||
self.on_eof.set_result(True)
|
||||
|
||||
async def client(addr):
|
||||
await asyncio.sleep(0.5, loop=self.loop)
|
||||
await asyncio.sleep(0.5)
|
||||
|
||||
on_data = self.loop.create_future()
|
||||
on_eof = self.loop.create_future()
|
||||
|
@ -418,12 +418,11 @@ class BaseStartTLS(func_tests.FunctionalTestCaseMixin):
|
|||
with self.assertRaises(asyncio.TimeoutError):
|
||||
await asyncio.wait_for(
|
||||
self.loop.start_tls(tr, proto, client_context),
|
||||
0.5,
|
||||
loop=self.loop)
|
||||
0.5)
|
||||
|
||||
with self.tcp_server(serve, timeout=self.TIMEOUT) as srv:
|
||||
self.loop.run_until_complete(
|
||||
asyncio.wait_for(client(srv.addr), loop=self.loop, timeout=10))
|
||||
asyncio.wait_for(client(srv.addr), timeout=10))
|
||||
|
||||
def test_start_tls_server_1(self):
|
||||
HELLO_MSG = b'1' * self.PAYLOAD_SIZE
|
||||
|
@ -496,7 +495,7 @@ class BaseStartTLS(func_tests.FunctionalTestCaseMixin):
|
|||
timeout=self.TIMEOUT):
|
||||
await asyncio.wait_for(
|
||||
main(proto, on_con, on_eof, on_con_lost),
|
||||
loop=self.loop, timeout=self.TIMEOUT)
|
||||
timeout=self.TIMEOUT)
|
||||
|
||||
server.close()
|
||||
await server.wait_closed()
|
||||
|
@ -541,8 +540,7 @@ class BaseStartTLS(func_tests.FunctionalTestCaseMixin):
|
|||
ssl=client_sslctx,
|
||||
server_hostname='',
|
||||
ssl_handshake_timeout=10.0),
|
||||
0.5,
|
||||
loop=self.loop)
|
||||
0.5)
|
||||
|
||||
with self.tcp_server(server,
|
||||
max_clients=1,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue