From 00218aa9f2cf98d291b7c0f3a71e145e5ff71376 Mon Sep 17 00:00:00 2001 From: Adam Hopkins Date: Thu, 31 Mar 2022 14:30:30 +0300 Subject: [PATCH] 22.3 Internal version bumps (#2419) --- examples/delayed_response.py | 1 + sanic/app.py | 3 +-- setup.py | 4 ++-- tests/test_headers.py | 11 ++++++----- tests/test_routes.py | 2 +- tests/test_unix_socket.py | 2 +- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/examples/delayed_response.py b/examples/delayed_response.py index 141bf06a..91e24773 100644 --- a/examples/delayed_response.py +++ b/examples/delayed_response.py @@ -4,6 +4,7 @@ from sanic import Sanic, response app = Sanic("DelayedResponseApp", strict_slashes=True) +app.config.AUTO_EXTEND = False @app.get("/") diff --git a/sanic/app.py b/sanic/app.py index 07de2eb1..a67b437d 100644 --- a/sanic/app.py +++ b/sanic/app.py @@ -11,7 +11,6 @@ from asyncio import ( CancelledError, Task, ensure_future, - get_event_loop_policy, get_running_loop, wait_for, ) @@ -253,7 +252,7 @@ class Sanic(BaseSanic, RunnerMixin, metaclass=TouchUpMeta): "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 4dfeaa9d..966006d9 100644 --- a/setup.py +++ b/setup.py @@ -84,7 +84,7 @@ ujson = "ujson>=1.35" + env_dependency 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 @@ requirements = [ ] 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 115bed86..7b2235ed 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 be23909f..6fdf97d5 100644 --- a/tests/test_routes.py +++ b/tests/test_routes.py @@ -254,7 +254,7 @@ def test_route_strict_slash(app): 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 ea3b4b1d..12b286b4 100644 --- a/tests/test_unix_socket.py +++ b/tests/test_unix_socket.py @@ -199,7 +199,7 @@ async def test_zero_downtime(): 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():