From: Victor Stinner Date: Wed, 6 Jun 2018 23:30:38 +0000 (+0200) Subject: bpo-32676, test_asyncio: Fix warning in test_error_in_call_soon() (GH-7462) X-Git-Tag: v3.8.0a1~1645 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9f04f0df6fdb27190690bda949d213893d14e807;p=thirdparty%2FPython%2Fcpython.git 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. --- diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py index 1079d49a4021..a5442f5fdfff 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]