[Python-checkins] bpo-32633: Fix some warnings in test_asyncio.test_tasks (#5280)
Andrew Svetlov
webhook-mailer at python.org
Tue Jan 23 04:09:38 EST 2018
https://github.com/python/cpython/commit/6934831e43d66222a626403dd775429d1c8963f3
commit: 6934831e43d66222a626403dd775429d1c8963f3
branch: master
author: Nathaniel J. Smith <njs at pobox.com>
committer: Andrew Svetlov <andrew.svetlov at gmail.com>
date: 2018-01-23T11:09:31+02:00
summary:
bpo-32633: Fix some warnings in test_asyncio.test_tasks (#5280)
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 96d2658cb4c..1c361c8ec17 100644
--- a/Lib/test/test_asyncio/test_tasks.py
+++ b/Lib/test/test_asyncio/test_tasks.py
@@ -2342,7 +2342,8 @@ def test_set_result_causes_invalid_state(self):
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 @@ def test_set_result_causes_invalid_state(self):
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 MyExc(Exception):
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 MyExc(Exception):
r'step\(\): already done'):
raise exc
+ coro.close()
+
@unittest.skipUnless(hasattr(futures, '_CFuture') and
hasattr(tasks, '_CTask'),
More information about the Python-checkins
mailing list