diff --git a/async_asgi_testclient/tests/test_testing.py b/async_asgi_testclient/tests/test_testing.py index ecd37cb..653e92c 100644 --- a/async_asgi_testclient/tests/test_testing.py +++ b/async_asgi_testclient/tests/test_testing.py @@ -1,15 +1,14 @@ import ast - -import starlette.status - -from async_asgi_testclient import TestClient +import asyncio +import io from http.cookies import SimpleCookie from json import dumps from sys import version_info as PY_VER # noqa -import asyncio -import io import pytest +import starlette.status + +from async_asgi_testclient import TestClient @pytest.fixture @@ -477,7 +476,7 @@ async def test_ws_connect_custom_scheme(starlette_app): async def test_ws_endpoint_with_immediate_rejection(starlette_app): async with TestClient(starlette_app, timeout=0.1) as client: try: - async with client.websocket_connect("/ws-reject") as ws: + async with client.websocket_connect("/ws-reject"): pass except Exception as e: thrown_exception = e @@ -492,7 +491,7 @@ async def test_ws_endpoint_with_immediate_rejection(starlette_app): async def test_invalid_ws_endpoint(starlette_app): async with TestClient(starlette_app, timeout=0.1) as client: try: - async with client.websocket_connect("/invalid") as ws: + async with client.websocket_connect("/invalid"): pass except Exception as e: thrown_exception = e @@ -536,6 +535,7 @@ async def test_quart_ws_connect_inherits_test_client_cookies(quart_app): @pytest.mark.asyncio +@pytest.mark.skipif("PY_VER < (3,7)") async def test_quart_ws_connect_default_scheme(quart_app): async with TestClient(quart_app, timeout=0.1) as client: async with client.websocket_connect("/ws") as ws: @@ -559,7 +559,7 @@ async def test_quart_ws_connect_custom_scheme(quart_app): async def test_quart_ws_endpoint_with_immediate_rejection(quart_app): async with TestClient(quart_app, timeout=0.1) as client: try: - async with client.websocket_connect("/ws-reject") as ws: + async with client.websocket_connect("/ws-reject"): pass except Exception as e: thrown_exception = e @@ -575,7 +575,7 @@ async def test_quart_ws_endpoint_with_immediate_rejection(quart_app): async def test_quart_invalid_ws_endpoint(quart_app): async with TestClient(quart_app, timeout=0.1) as client: try: - async with client.websocket_connect("/invalid") as ws: + async with client.websocket_connect("/invalid"): pass except Exception as e: thrown_exception = e diff --git a/test-requirements.txt b/test-requirements.txt index 749a341..9f0d54a 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,5 +1,5 @@ quart==0.10.0; python_version >= '3.7' -starlette==0.12.13 +starlette==0.19.1 python-multipart==0.0.5 pytest==6.2.5 pytest-asyncio==0.15.0