From a362ad3dc17b8160363733e7966825846c8a07aa Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Fri, 12 Mar 2021 12:06:15 +0000 Subject: [PATCH 1/2] Drop flaky connection tests --- tests/async_tests/test_interfaces.py | 38 ---------------------------- tests/sync_tests/test_interfaces.py | 38 ---------------------------- 2 files changed, 76 deletions(-) diff --git a/tests/async_tests/test_interfaces.py b/tests/async_tests/test_interfaces.py index ac2483254..c02a93b9f 100644 --- a/tests/async_tests/test_interfaces.py +++ b/tests/async_tests/test_interfaces.py @@ -467,41 +467,3 @@ async def test_cannot_connect_uds(backend: str) -> None: async with httpcore.AsyncConnectionPool(backend=backend, uds=uds) as http: with pytest.raises(httpcore.ConnectError): await http.arequest(method, url) - - -@pytest.mark.skipif( - sys.version_info[:2] < (3, 7), - reason="Hypercorn doesn't support python < 3.7 (this test is local-only)", -) -@pytest.mark.anyio -async def test_connection_timeout_tcp(backend: str, server: Server) -> None: - # we try to access http server using https. It caused some SSL timeouts - # in TLSStream.wrap inside inside AnyIOBackend.open_tcp_stream - method = b"GET" - url = (b"https", *server.netloc, b"/") - headers = [server.host_header] - ext = {"timeout": {"connect": 0.1}} - - async with httpcore.AsyncConnectionPool(backend=backend) as http: - with pytest.raises(httpcore.ConnectTimeout): - await http.arequest(method, url, headers, ext=ext) - - -@pytest.mark.skipif( - sys.version_info[:2] < (3, 7), - reason="Hypercorn doesn't support python < 3.7 (this test is local-only)", -) -@pytest.mark.anyio -async def test_connection_timeout_uds( - backend: str, uds_server: Server, uds: str -) -> None: - # we try to access http server using https. It caused some SSL timeouts - # in TLSStream.wrap inside AnyIOBackend.open_uds_stream - method = b"GET" - url = (b"https", b"localhost", None, b"/") - headers = [(b"host", b"localhost")] - ext = {"timeout": {"connect": 0.1}} - - async with httpcore.AsyncConnectionPool(uds=uds, backend=backend) as http: - with pytest.raises(httpcore.ConnectTimeout): - await http.arequest(method, url, headers, ext=ext) diff --git a/tests/sync_tests/test_interfaces.py b/tests/sync_tests/test_interfaces.py index e1db92c87..bb795bdc3 100644 --- a/tests/sync_tests/test_interfaces.py +++ b/tests/sync_tests/test_interfaces.py @@ -467,41 +467,3 @@ def test_cannot_connect_uds(backend: str) -> None: with httpcore.SyncConnectionPool(backend=backend, uds=uds) as http: with pytest.raises(httpcore.ConnectError): http.request(method, url) - - -@pytest.mark.skipif( - sys.version_info[:2] < (3, 7), - reason="Hypercorn doesn't support python < 3.7 (this test is local-only)", -) - -def test_connection_timeout_tcp(backend: str, server: Server) -> None: - # we try to access http server using https. It caused some SSL timeouts - # in TLSStream.wrap inside inside AnyIOBackend.open_tcp_stream - method = b"GET" - url = (b"https", *server.netloc, b"/") - headers = [server.host_header] - ext = {"timeout": {"connect": 0.1}} - - with httpcore.SyncConnectionPool(backend=backend) as http: - with pytest.raises(httpcore.ConnectTimeout): - http.request(method, url, headers, ext=ext) - - -@pytest.mark.skipif( - sys.version_info[:2] < (3, 7), - reason="Hypercorn doesn't support python < 3.7 (this test is local-only)", -) - -def test_connection_timeout_uds( - backend: str, uds_server: Server, uds: str -) -> None: - # we try to access http server using https. It caused some SSL timeouts - # in TLSStream.wrap inside AnyIOBackend.open_uds_stream - method = b"GET" - url = (b"https", b"localhost", None, b"/") - headers = [(b"host", b"localhost")] - ext = {"timeout": {"connect": 0.1}} - - with httpcore.SyncConnectionPool(uds=uds, backend=backend) as http: - with pytest.raises(httpcore.ConnectTimeout): - http.request(method, url, headers, ext=ext) From c906d937159814eedf0ee7e77240f29710eea9f9 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Fri, 12 Mar 2021 12:10:58 +0000 Subject: [PATCH 2/2] Linting --- tests/async_tests/test_interfaces.py | 1 - tests/sync_tests/test_interfaces.py | 1 - 2 files changed, 2 deletions(-) diff --git a/tests/async_tests/test_interfaces.py b/tests/async_tests/test_interfaces.py index c02a93b9f..814647900 100644 --- a/tests/async_tests/test_interfaces.py +++ b/tests/async_tests/test_interfaces.py @@ -1,5 +1,4 @@ import platform -import sys import pytest diff --git a/tests/sync_tests/test_interfaces.py b/tests/sync_tests/test_interfaces.py index bb795bdc3..dade26b9e 100644 --- a/tests/sync_tests/test_interfaces.py +++ b/tests/sync_tests/test_interfaces.py @@ -1,5 +1,4 @@ import platform -import sys import pytest