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): 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]