From: Victor Stinner Date: Fri, 27 Jun 2014 23:19:11 +0000 (+0200) Subject: asyncio: Fix two "Coroutine xxx was never yielded from" messages in tests X-Git-Tag: v3.4.2rc1~295 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=09e7590801d6d18668afa7327069fc3002f0249d;p=python asyncio: Fix two "Coroutine xxx was never yielded from" messages in tests --- diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py index dee14b2e0a..b4a3092eaf 100644 --- a/Lib/test/test_asyncio/test_tasks.py +++ b/Lib/test/test_asyncio/test_tasks.py @@ -1423,8 +1423,10 @@ class TaskTests(test_utils.TestCase): # as_completed() expects a list of futures, not a future instance self.assertRaises(TypeError, self.loop.run_until_complete, asyncio.as_completed(fut, loop=self.loop)) + coro = coroutine_function() self.assertRaises(TypeError, self.loop.run_until_complete, - asyncio.as_completed(coroutine_function(), loop=self.loop)) + asyncio.as_completed(coro, loop=self.loop)) + coro.close() def test_wait_invalid_args(self): fut = asyncio.Future(loop=self.loop) @@ -1432,8 +1434,10 @@ class TaskTests(test_utils.TestCase): # wait() expects a list of futures, not a future instance self.assertRaises(TypeError, self.loop.run_until_complete, asyncio.wait(fut, loop=self.loop)) + coro = coroutine_function() self.assertRaises(TypeError, self.loop.run_until_complete, - asyncio.wait(coroutine_function(), loop=self.loop)) + asyncio.wait(coro, loop=self.loop)) + coro.close() # wait() expects at least a future self.assertRaises(ValueError, self.loop.run_until_complete,