diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-04-01 19:40:14 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-04-01 19:40:14 (GMT) |
commit | 89d3f53aacc78a196bc2f57643a19b15974aa630 (patch) | |
tree | e70e35a9c1e76a96ab1f352ed99013a975c12ae0 /Lib/test | |
parent | dcfebb32e277a68b9c6582e6a0484e6dc24e9b66 (diff) | |
parent | 2ba8ece5beb64126c719a837431cee3de890e451 (diff) | |
download | cpython-89d3f53aacc78a196bc2f57643a19b15974aa630.zip cpython-89d3f53aacc78a196bc2f57643a19b15974aa630.tar.gz cpython-89d3f53aacc78a196bc2f57643a19b15974aa630.tar.bz2 |
Merge 3.5 (asyncio)
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_asyncio/test_tasks.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_tasks.py b/Lib/test/test_asyncio/test_tasks.py index acceb9b..40e5f88 100644 --- a/Lib/test/test_asyncio/test_tasks.py +++ b/Lib/test/test_asyncio/test_tasks.py @@ -2382,6 +2382,22 @@ class TimeoutTests(test_utils.TestCase): self.loop.run_until_complete(go()) + def test_timeout_disable(self): + @asyncio.coroutine + def long_running_task(): + yield from asyncio.sleep(0.1, loop=self.loop) + return 'done' + + @asyncio.coroutine + def go(): + t0 = self.loop.time() + with asyncio.timeout(None, loop=self.loop): + resp = yield from long_running_task() + self.assertEqual(resp, 'done') + dt = self.loop.time() - t0 + self.assertTrue(0.09 < dt < 0.11, dt) + self.loop.run_until_complete(go()) + def test_raise_runtimeerror_if_no_task(self): with self.assertRaises(RuntimeError): with asyncio.timeout(0.1, loop=self.loop): |