[Python-checkins] cpython (3.4): Issue #21163: Fix one more "Task was destroyed but it is pending!" log in tests

victor.stinner python-checkins at python.org
Thu Jun 26 00:00:41 CEST 2014


http://hg.python.org/cpython/rev/4e4c6e2ed0c5
changeset: 91416:4e4c6e2ed0c5
branch: 3.4
parent: 91414:e9150fdf068a
user: Victor Stinner <victor.stinner at gmail.com>
date: Wed Jun 25 23:57:50 2014 +0200
summary:
 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

AltStyle によって変換されたページ (->オリジナル) /