Skip to content

Commit 2c8d665

Browse files
authored
[3.6] bpo-32676, test_asyncio: Fix warning in test_error_in_call_soon() (GH-7462) (GH-7483)
* bpo-32676, test_asyncio: Fix warning in test_error_in_call_soon() (GH-7462) Fix "<CoroWrapper ...> was never yielded from" warning in PyTask_PyFuture_Tests.test_error_in_call_soon() of test_asyncio.test_tasks. Close manually the coroutine on error. (cherry picked from commit 9f04f0d) * Hide a warning in test_asyncio test_cancel_handshake() SslProtoHandshakeTests.test_cancel_handshake() of test_asyncio.test_sslproto: hide a traceback about SSL handshake failure.
1 parent 21f2553 commit 2c8d665

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Lib/test/test_asyncio/test_sslproto.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ def do_handshake(callback):
5959
return []
6060

6161
waiter.cancel()
62-
self.connection_made(ssl_proto, do_handshake=do_handshake)
6362

6463
with test_utils.disable_logger():
64+
self.connection_made(ssl_proto, do_handshake=do_handshake)
6565
self.loop.run_until_complete(handshake_fut)
6666

6767
def test_eof_received_waiter(self):

Lib/test/test_asyncio/test_tasks.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2076,7 +2076,11 @@ def coro():
20762076
self.assertFalse(m_log.error.called)
20772077

20782078
with self.assertRaises(ValueError):
2079-
self.new_task(self.loop, coro())
2079+
gen = coro()
2080+
try:
2081+
self.new_task(self.loop, gen)
2082+
finally:
2083+
gen.close()
20802084

20812085
self.assertTrue(m_log.error.called)
20822086
message = m_log.error.call_args[0][0]

0 commit comments

Comments
 (0)