[Python-checkins] cpython (merge 3.4 -> default): (Merge 3.4) Issue #21163: Fix one more "Task was destroyed but it is pending!"
victor.stinner
python-checkins at python.org
Thu Jun 26 00:00:42 CEST 2014
http://hg.python.org/cpython/rev/24282c6f6019
changeset: 91417:24282c6f6019
parent: 91415:d92dc4462d26
parent: 91416:4e4c6e2ed0c5
user: Victor Stinner <victor.stinner at gmail.com>
date: Wed Jun 25 23:59:31 2014 +0200
summary:
(Merge 3.4) Issue #21163: Fix one more "Task was destroyed but it is pending!"
log in tests
files:
Lib/test/test_asyncio/test_tasks.py | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py
--- a/Lib/test/test_asyncio/test_tasks.py
+++ b/Lib/test/test_asyncio/test_tasks.py
@@ -411,8 +411,10 @@
loop.stop()
t = asyncio.Task(task(), loop=loop)
- self.assertRaises(
- RuntimeError, loop.run_until_complete, t)
+ with self.assertRaises(RuntimeError) as cm:
+ loop.run_until_complete(t)
+ self.assertEqual(str(cm.exception),
+ 'Event loop stopped before Future completed.')
self.assertFalse(t.done())
self.assertEqual(x, 2)
self.assertAlmostEqual(0.3, loop.time())
@@ -420,6 +422,8 @@
# close generators
for w in waiters:
w.close()
+ t.cancel()
+ self.assertRaises(asyncio.CancelledError, loop.run_until_complete, t)
def test_wait_for(self):
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list