summaryrefslogtreecommitdiff
path: root/Lib/test/test_asyncio/test_tasks.py
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-06-07 01:30:38 +0200
committerGitHub <noreply@github.com>2018-06-07 01:30:38 +0200
commit9f04f0df6fdb27190690bda949d213893d14e807 (patch)
tree277223e635b4e779d4f839f9f7957ae900008ffd /Lib/test/test_asyncio/test_tasks.py
parent7ed61e9431ee2c191aeeeb26f86a71bb90ab99fd (diff)
downloadcpython-git-9f04f0df6fdb27190690bda949d213893d14e807.tar.gz
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.
Diffstat (limited to 'Lib/test/test_asyncio/test_tasks.py')
-rw-r--r--Lib/test/test_asyncio/test_tasks.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py
index 1079d49a40..a5442f5fdf 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]