diff --git a/examples/delayed_response.py b/examples/delayed_response.py index 141bf06a73..91e2477329 100644 --- a/examples/delayed_response.py +++ b/examples/delayed_response.py @@ -4,6 +4,7 @@ app = Sanic("DelayedResponseApp", strict_slashes=True) +app.config.AUTO_EXTEND = False @app.get("/") diff --git a/sanic/app.py b/sanic/app.py index 07de2eb1dc..a67b437dcc 100644 --- a/sanic/app.py +++ b/sanic/app.py @@ -11,7 +11,6 @@ CancelledError, Task, ensure_future, - get_event_loop_policy, get_running_loop, wait_for, ) @@ -253,7 +252,7 @@ def loop(self): "Loop can only be retrieved after the app has started " "running. Not supported with `create_server` function" ) - return get_event_loop_policy().get_event_loop() + return get_running_loop() # -------------------------------------------------------------------- # # Registration diff --git a/setup.py b/setup.py index 4dfeaa9daf..966006d966 100644 --- a/setup.py +++ b/setup.py @@ -84,7 +84,7 @@ def open_local(paths, mode="r", encoding="utf8"): uvloop = "uvloop>=0.5.3" + env_dependency types_ujson = "types-ujson" + env_dependency requirements = [ - "sanic-routing~=0.7", + "sanic-routing>=22.3.0,<22.6.0", "httptools>=0.0.10", uvloop, ujson, @@ -94,7 +94,7 @@ def open_local(paths, mode="r", encoding="utf8"): ] tests_require = [ - "sanic-testing>=0.7.0", + "sanic-testing>=22.3.0", "pytest==6.2.5", "coverage==5.3", "gunicorn==20.0.4", diff --git a/tests/test_headers.py b/tests/test_headers.py index 115bed86b3..7b2235edd0 100644 --- a/tests/test_headers.py +++ b/tests/test_headers.py @@ -164,11 +164,12 @@ def test_raw_headers(app): }, ) - assert request.raw_headers == ( - b"Host: example.com\r\nAccept: */*\r\nAccept-Encoding: gzip, " - b"deflate\r\nConnection: keep-alive\r\nUser-Agent: " - b"Sanic-Testing\r\nFOO: bar" - ) + assert b"Host: example.com" in request.raw_headers + assert b"Accept: */*" in request.raw_headers + assert b"Accept-Encoding: gzip, deflate" in request.raw_headers + assert b"Connection: keep-alive" in request.raw_headers + assert b"User-Agent: Sanic-Testing" in request.raw_headers + assert b"FOO: bar" in request.raw_headers def test_request_line(app): diff --git a/tests/test_routes.py b/tests/test_routes.py index be23909f04..6fdf97d594 100644 --- a/tests/test_routes.py +++ b/tests/test_routes.py @@ -254,7 +254,7 @@ def handler2(request): def test_route_invalid_parameter_syntax(app): - with pytest.raises(ValueError): + with pytest.raises(InvalidUsage): @app.get("/get/<:str>", strict_slashes=True) def handler(request): diff --git a/tests/test_unix_socket.py b/tests/test_unix_socket.py index ea3b4b1dc8..12b286b400 100644 --- a/tests/test_unix_socket.py +++ b/tests/test_unix_socket.py @@ -199,7 +199,7 @@ async def client(): for _ in range(40): async with httpx.AsyncClient(transport=transport) as client: r = await client.get("http://localhost/sleep/0.1") - assert r.status_code == 200, r.content + assert r.status_code == 200, r.text assert r.text == "Slept 0.1 seconds.\n" def spawn():