diff --git a/requirements-testing.txt b/requirements-testing.txt index a6041972cd..2d0087e4fa 100644 --- a/requirements-testing.txt +++ b/requirements-testing.txt @@ -14,5 +14,4 @@ pysocks socksio httpcore[http2] setuptools -Brotli docker diff --git a/scripts/populate_tox/tox.jinja b/scripts/populate_tox/tox.jinja index 40426d30fb..a4d1bb2e3e 100644 --- a/scripts/populate_tox/tox.jinja +++ b/scripts/populate_tox/tox.jinja @@ -79,6 +79,7 @@ deps = # === Common === py3.8-common: hypothesis + common: brotli common: pytest-asyncio common: httpcore[asyncio] # See https://github.com/pytest-dev/pytest/issues/9621 @@ -97,6 +98,7 @@ deps = # for justification of the upper bound on pytest {py3.6,py3.7}-gevent: pytest<7.0.0 {py3.8,py3.9,py3.10,py3.11,py3.12}-gevent: pytest + gevent: brotli gevent: pytest-asyncio gevent: setuptools<82 {py3.10,py3.11}-gevent: zope.event<5.0.0 diff --git a/tests/conftest.py b/tests/conftest.py index 11abd66e46..c73bbdcbcc 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -13,7 +13,11 @@ from unittest import mock from urllib.parse import parse_qs, urlparse -import brotli +try: + import brotli +except ImportError: + brotli = None + import jsonschema import pytest from pytest_localserver.http import WSGIServer @@ -1641,6 +1645,7 @@ def __call__(self, environ, start_response): rdr = gzip.GzipFile(fileobj=io.BytesIO(request.data)) compressed = True elif content_encoding == "br": + assert brotli is not None rdr = io.BytesIO(brotli.decompress(request.data)) compressed = True else: diff --git a/tox.ini b/tox.ini index e91115d32e..d631cd06d8 100644 --- a/tox.ini +++ b/tox.ini @@ -402,6 +402,7 @@ deps = # === Common === py3.8-common: hypothesis + common: brotli common: pytest-asyncio common: httpcore[asyncio] # See https://github.com/pytest-dev/pytest/issues/9621 @@ -420,6 +421,7 @@ deps = # for justification of the upper bound on pytest {py3.6,py3.7}-gevent: pytest<7.0.0 {py3.8,py3.9,py3.10,py3.11,py3.12}-gevent: pytest + gevent: brotli gevent: pytest-asyncio gevent: setuptools<82 {py3.10,py3.11}-gevent: zope.event<5.0.0