fix async run, add tests

This commit is contained in:
Raphael Deem
2017-01-28 15:26:44 -08:00
parent 7257e5794f
commit 41da793b5a
4 changed files with 46 additions and 1 deletions

View File

@@ -297,7 +297,8 @@ def serve(host, port, request_handler, error_handler, before_start=None,
:param protocol: Subclass of asyncio protocol class
:return: Nothing
"""
loop = async_loop.new_event_loop()
loop = loop or async_loop.new_event_loop()
asyncio.set_event_loop_policy(async_loop.EventLoopPolicy())
asyncio.set_event_loop(loop)
if debug: