From: Marcelo Trylesinski Date: Thu, 5 May 2022 09:04:10 +0000 (+0200) Subject: Skip test when brotli is installed (#1620) X-Git-Tag: 0.20.1~14 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d425c84b105c9df9a29d24cef01422d699e3574f;p=thirdparty%2Fstarlette.git Skip test when brotli is installed (#1620) * Skip test when brotli is installed * A better reason message --- diff --git a/tests/test_requests.py b/tests/test_requests.py index 799e61f8..033df1e6 100644 --- a/tests/test_requests.py +++ b/tests/test_requests.py @@ -1,3 +1,4 @@ +import sys from typing import Optional import anyio @@ -36,6 +37,10 @@ def test_request_query_params(test_client_factory): assert response.json() == {"params": {"a": "123", "b": "456"}} +@pytest.mark.skipif( + any(module in sys.modules for module in ("brotli", "brotlicffi")), + reason='urllib3 includes "br" to the "accept-encoding" headers.', +) def test_request_headers(test_client_factory): async def app(scope, receive, send): request = Request(scope, receive) diff --git a/tests/test_websockets.py b/tests/test_websockets.py index f3970967..c1ec1153 100644 --- a/tests/test_websockets.py +++ b/tests/test_websockets.py @@ -1,3 +1,5 @@ +import sys + import anyio import pytest @@ -48,6 +50,10 @@ def test_websocket_query_params(test_client_factory): assert data == {"params": {"a": "abc", "b": "456"}} +@pytest.mark.skipif( + any(module in sys.modules for module in ("brotli", "brotlicffi")), + reason='urllib3 includes "br" to the "accept-encoding" headers.', +) def test_websocket_headers(test_client_factory): async def app(scope: Scope, receive: Receive, send: Send) -> None: websocket = WebSocket(scope, receive=receive, send=send)