changeset: 91416:4e4c6e2ed0c5 branch: 3.4 parent: 91414:e9150fdf068a user: Victor Stinner date: Wed Jun 25 23:57:50 2014 +0200 files: Lib/test/test_asyncio/test_tasks.py description: Issue #21163: Fix one more "Task was destroyed but it is pending!" log in tests diff -r e9150fdf068a -r 4e4c6e2ed0c5 Lib/test/test_asyncio/test_tasks.py --- a/Lib/test/test_asyncio/test_tasks.py Wed Jun 25 23:32:25 2014 +0200 +++ b/Lib/test/test_asyncio/test_tasks.py Wed Jun 25 23:57:50 2014 +0200 @@ -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):