diff options
author | Nathaniel J. Smith <njs@pobox.com> | 2018-01-23 09:09:31 (GMT) |
---|---|---|
committer | Andrew Svetlov <andrew.svetlov@gmail.com> | 2018-01-23 09:09:31 (GMT) |
commit | 6934831e43d66222a626403dd775429d1c8963f3 (patch) | |
tree | 92da636130bf399712d84c742589542d961180d8 /Lib/test/test_asyncio | |
parent | 83c8675edb4fe278c5d930f7865977a5d3c7168a (diff) | |
download | cpython-6934831e43d66222a626403dd775429d1c8963f3.zip cpython-6934831e43d66222a626403dd775429d1c8963f3.tar.gz cpython-6934831e43d66222a626403dd775429d1c8963f3.tar.bz2 |
bpo-32633: Fix some warnings in test_asyncio.test_tasks (#5280)
Diffstat (limited to 'Lib/test/test_asyncio')
-rw-r--r-- | Lib/test/test_asyncio/test_tasks.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py index 96d2658..1c361c8 100644 --- a/Lib/test/test_asyncio/test_tasks.py +++ b/Lib/test/test_asyncio/test_tasks.py @@ -2342,7 +2342,8 @@ class SetMethodsTest: await asyncio.sleep(0.1, loop=self.loop) return 10 - task = self.new_task(self.loop, foo()) + coro = foo() + task = self.new_task(self.loop, coro) Future.set_result(task, 'spam') self.assertEqual( @@ -2355,6 +2356,8 @@ class SetMethodsTest: r'step\(\): already done'): raise exc + coro.close() + def test_set_exception_causes_invalid_state(self): class MyExc(Exception): pass @@ -2366,7 +2369,8 @@ class SetMethodsTest: await asyncio.sleep(0.1, loop=self.loop) return 10 - task = self.new_task(self.loop, foo()) + coro = foo() + task = self.new_task(self.loop, coro) Future.set_exception(task, MyExc()) with self.assertRaises(MyExc): @@ -2378,6 +2382,8 @@ class SetMethodsTest: r'step\(\): already done'): raise exc + coro.close() + @unittest.skipUnless(hasattr(futures, '_CFuture') and hasattr(tasks, '_CTask'), |