From a2033af389a58d2b7437498777c30de4e67389f3 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 7 Jun 2018 01:08:18 +0200 Subject: [PATCH] bpo-32676, test_asyncio: Fix warning in test_error_in_call_soon() 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. --- 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 1c1a0ac01f5c16..fb66cc65207467 100644 --- a/Lib/test/test_asyncio/test_tasks.py +++ b/Lib/test/test_asyncio/test_tasks.py @@ -2182,7 +2182,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]