[Python-checkins] bpo-32676, test_asyncio: Fix warning in test_error_in_call_soon() (GH-7462)
Victor Stinner
webhook-mailer at python.org
Wed Jun 6 19:30:42 EDT 2018
https://github.com/python/cpython/commit/9f04f0df6fdb27190690bda949d213893d14e807
commit: 9f04f0df6fdb27190690bda949d213893d14e807
branch: master
author: Victor Stinner <vstinner at redhat.com>
committer: GitHub <noreply at github.com>
date: 2018-06-07T01:30:38+02:00
summary:
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.
files:
M Lib/test/test_asyncio/test_tasks.py
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 @@ 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]
More information about the Python-checkins
mailing list