summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-06-22 23:02:37 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-06-22 23:02:37 (GMT)
commitf328c7dc69da14766435d8608f89d81cd878bb4d (patch)
treee28c9941def58676945ff046468695a6f0a25561 /Lib/test/test_asyncio
parent62511fd6d62ef53c1d3d050b478750efc5a7014c (diff)
downloadcpython-f328c7dc69da14766435d8608f89d81cd878bb4d.zip
cpython-f328c7dc69da14766435d8608f89d81cd878bb4d.tar.gz
cpython-f328c7dc69da14766435d8608f89d81cd878bb4d.tar.bz2
asyncio, Tulip issue 171: BaseEventLoop.close() now raises an exception if the
event loop is running. You must first stop the event loop and then wait until it stopped, before closing it.
Diffstat (limited to 'Lib/test/test_asyncio')
-rw-r--r--Lib/test/test_asyncio/test_events.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py
index 37e45e1..020d123 100644
--- a/Lib/test/test_asyncio/test_events.py
+++ b/Lib/test/test_asyncio/test_events.py
@@ -1365,6 +1365,15 @@ class EventLoopTestsMixin:
with self.assertRaises(RuntimeError):
loop.add_writer(w, callback)
+ def test_close_running_event_loop(self):
+ @asyncio.coroutine
+ def close_loop(loop):
+ self.loop.close()
+
+ coro = close_loop(self.loop)
+ with self.assertRaises(RuntimeError):
+ self.loop.run_until_complete(coro)
+
class SubprocessTestsMixin: