bpo-32676, test_asyncio: Fix warning in test_error_in_call_soon() (GH-7462)

Fix "<CoroWrapper ...> 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.
This commit is contained in:
Victor Stinner 2018-06-07 01:30:38 +02:00 committed by GitHub
parent 7ed61e9431
commit 9f04f0df6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -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]