diff --git a/sanic/server.py b/sanic/server.py index 8081cb30..48c3827e 100644 --- a/sanic/server.py +++ b/sanic/server.py @@ -297,8 +297,7 @@ def serve(host, port, request_handler, error_handler, before_start=None, :param protocol: Subclass of asyncio protocol class :return: Nothing """ - loop = loop or async_loop.new_event_loop() - asyncio.set_event_loop_policy(async_loop.EventLoopPolicy()) + loop = async_loop.new_event_loop() asyncio.set_event_loop(loop) if debug: diff --git a/tests/test_async_run.py b/tests/test_async_run.py deleted file mode 100644 index 4e7d68cd..00000000 --- a/tests/test_async_run.py +++ /dev/null @@ -1,25 +0,0 @@ -from sanic import Sanic -from sanic.response import json -import asyncio -import requests -from threading import Thread -import pytest -import sys - -@pytest.mark.skipif(sys.version_info < (3, 6), - reason="fails on python 3.5 with travis") -def test_async_run(): - app = Sanic(__name__) - - @app.route("/") - async def test(request): - return json({"answer": "42"}) - - server = app.create_server(host="0.0.0.0", port=8001) - task = asyncio.ensure_future(server) - loop = asyncio.get_event_loop() - t = Thread(target=loop.run_forever) - t.start() - res = requests.get('http://localhost:8001') - loop.stop() - assert res.json()['answer'] == '42' diff --git a/tests/test_loop_policy.py b/tests/test_loop_policy.py deleted file mode 100644 index 7737b6b0..00000000 --- a/tests/test_loop_policy.py +++ /dev/null @@ -1,18 +0,0 @@ -from sanic import Sanic -from sanic.response import text -from sanic.utils import sanic_endpoint_test -import asyncio -import uvloop - -def test_loop_policy(): - app = Sanic('test_loop_policy') - - @app.route('/') - def test(request): - return text("OK") - - server = app.create_server() - - request, response = sanic_endpoint_test(app) - assert isinstance(asyncio.get_event_loop_policy(), - uvloop.EventLoopPolicy) diff --git a/tox.ini b/tox.ini index 8669e48b..009d971c 100644 --- a/tox.ini +++ b/tox.ini @@ -14,7 +14,6 @@ deps = aiohttp pytest beautifulsoup4 - requests commands = pytest tests {posargs}