diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-06-25 21:57:50 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-06-25 21:57:50 (GMT) |
commit | 72502c12a767cc1d419b8dd902dca9bf96c9f29f (patch) | |
tree | 233432ea7009c020dc86a41d93fd0d770b85b496 | |
parent | 7ba40610983f016b9c863523e7252f873a52abca (diff) | |
download | cpython-72502c12a767cc1d419b8dd902dca9bf96c9f29f.zip cpython-72502c12a767cc1d419b8dd902dca9bf96c9f29f.tar.gz cpython-72502c12a767cc1d419b8dd902dca9bf96c9f29f.tar.bz2 |
Issue #21163: Fix one more "Task was destroyed but it is pending!" log in tests
-rw-r--r-- | 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 index 4508987..b19d7cc 100644 --- a/Lib/test/test_asyncio/test_tasks.py +++ b/Lib/test/test_asyncio/test_tasks.py @@ -411,8 +411,10 @@ class TaskTests(test_utils.TestCase): 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 @@ class TaskTests(test_utils.TestCase): # close generators for w in waiters: w.close() + t.cancel() + self.assertRaises(asyncio.CancelledError, loop.run_until_complete, t) def test_wait_for(self): |