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.
This commit is contained in:
Victor Stinner 2014-06-23 01:02:37 +02:00
parent 62511fd6d6
commit f328c7dc69
6 changed files with 18 additions and 3 deletions

View file

@ -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: