Skip to content

Commit 9f04f0d

Browse files
authored
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.
1 parent 7ed61e9 commit 9f04f0d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Lib/test/test_asyncio/test_tasks.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2182,7 +2182,11 @@ def coro():
21822182
self.assertFalse(m_log.error.called)
21832183

21842184
with self.assertRaises(ValueError):
2185-
self.new_task(self.loop, coro())
2185+
gen = coro()
2186+
try:
2187+
self.new_task(self.loop, gen)
2188+
finally:
2189+
gen.close()
21862190

21872191
self.assertTrue(m_log.error.called)
21882192
message = m_log.error.call_args[0][0]

0 commit comments

Comments
 (0)