From 0a44d6bb35b37f9441b82a456f8df8821b0b8f92 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 7 Jun 2018 01:30:38 +0200 Subject: [PATCH 1/2] bpo-32676, test_asyncio: Fix warning in test_error_in_call_soon() (GH-7462) Fix " 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 9f04f0df6fdb27190690bda949d213893d14e807) --- Lib/test/test_asyncio/test_tasks.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py index 7c5187348bc4ac..e8ec09efd4ad98 100644 --- a/Lib/test/test_asyncio/test_tasks.py +++ b/Lib/test/test_asyncio/test_tasks.py @@ -2076,7 +2076,11 @@ def coro(): self.assertFalse(m_log.error.called) with self.assertRaises(ValueError): - self.new_task(self.loop, coro()) + gen = coro() + try: + self.new_task(self.loop, gen) + finally: + gen.close() self.assertTrue(m_log.error.called) message = m_log.error.call_args[0][0] From 64f4939c2e8f44951f7bba92f4f1510745557553 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 7 Jun 2018 16:26:29 +0200 Subject: [PATCH 2/2] 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. --- Lib/test/test_asyncio/test_sslproto.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_asyncio/test_sslproto.py b/Lib/test/test_asyncio/test_sslproto.py index 9b198bfd53074a..4ffbc0fbec6bab 100644 --- a/Lib/test/test_asyncio/test_sslproto.py +++ b/Lib/test/test_asyncio/test_sslproto.py @@ -59,9 +59,9 @@ def do_handshake(callback): return [] waiter.cancel() - self.connection_made(ssl_proto, do_handshake=do_handshake) with test_utils.disable_logger(): + self.connection_made(ssl_proto, do_handshake=do_handshake) self.loop.run_until_complete(handshake_fut) def test_eof_received_waiter(self):