From 9f04f0df6fdb27190690bda949d213893d14e807 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 7 Jun 2018 01:30:38 +0200 Subject: 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. --- 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 1079d49..a5442f5 100644 --- a/Lib/test/test_asyncio/test_tasks.py +++ b/Lib/test/test_asyncio/test_tasks.py @@ -2182,7 +2182,11 @@ class BaseTaskTests: 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] -- cgit v0.12