diff --git a/tests/async_tests/test_interfaces.py b/tests/async_tests/test_interfaces.py index f21842e6f..136915559 100644 --- a/tests/async_tests/test_interfaces.py +++ b/tests/async_tests/test_interfaces.py @@ -469,6 +469,9 @@ async def test_cannot_connect_uds(backend: str) -> None: await http.arequest(method, url) +@pytest.mark.skipif( + sys.version_info[:2] < (3, 7), reason="Hypercorn doesn't support python < 3.7" +) @pytest.mark.anyio async def test_connection_timeout_tcp(backend: str, slow_tcp_server: Server) -> None: method = b"GET" diff --git a/tests/conftest.py b/tests/conftest.py index 3e7813353..40c4870e0 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -20,15 +20,14 @@ SERVER_HTTP_PORT = 80 SERVER_HTTPS_PORT = 443 HTTPS_SERVER_URL = "https://example.org" - SLOW_SERVER_HOST = "httpbin.org" - SLOW_SERVER_PORT = 443 else: SERVER_HOST = "localhost" SERVER_HTTP_PORT = 8002 SERVER_HTTPS_PORT = 8003 HTTPS_SERVER_URL = f"https://localhost:{SERVER_HTTPS_PORT}" - SLOW_SERVER_HOST = SERVER_HOST - SLOW_SERVER_PORT = 8004 + +SLOW_SERVER_HOST = SERVER_HOST +SLOW_SERVER_PORT = 8004 @pytest.fixture(scope="session") @@ -194,18 +193,14 @@ def https_server( @pytest.fixture(scope="session") def slow_tcp_server() -> typing.Iterator[Server]: - server: Server + assert hypercorn is not None - if hypercorn is None: - server = LiveServer(host=SLOW_SERVER_HOST, port=SLOW_SERVER_PORT) - yield server - else: - server = HypercornServer( - app=slow_app, bind=f"{SLOW_SERVER_HOST}:{SLOW_SERVER_PORT}" - ) + server = HypercornServer( + app=slow_app, bind=f"{SLOW_SERVER_HOST}:{SLOW_SERVER_PORT}" + ) - with server.serve_in_thread(): - yield server + with server.serve_in_thread(): + yield server @pytest.fixture(scope="function") diff --git a/tests/sync_tests/test_interfaces.py b/tests/sync_tests/test_interfaces.py index a78586488..ec0c1213a 100644 --- a/tests/sync_tests/test_interfaces.py +++ b/tests/sync_tests/test_interfaces.py @@ -469,6 +469,9 @@ def test_cannot_connect_uds(backend: str) -> None: http.request(method, url) +@pytest.mark.skipif( + sys.version_info[:2] < (3, 7), reason="Hypercorn doesn't support python < 3.7" +) def test_connection_timeout_tcp(backend: str, slow_tcp_server: Server) -> None: method = b"GET"