]> git.ipfire.org Git - thirdparty/starlette.git/commitdiff
Skip test when brotli is installed (#1620)
authorMarcelo Trylesinski <marcelotryle@gmail.com>
Thu, 5 May 2022 09:04:10 +0000 (11:04 +0200)
committerGitHub <noreply@github.com>
Thu, 5 May 2022 09:04:10 +0000 (11:04 +0200)
* Skip test when brotli is installed

* A better reason message

tests/test_requests.py
tests/test_websockets.py

index 799e61f805d026cf2755f2e8061fda3b013e0391..033df1e6aa94cf5e3848283baa9084d0848d41ae 100644 (file)
@@ -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)
index f3970967eaebda35ac319637b25562c2fd6a7e9d..c1ec1153e7df0e12b01dca58ab5ef3b6f06e2ea2 100644 (file)
@@ -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)