diff --git a/CHANGES/11363.packaging b/CHANGES/11363.packaging new file mode 100644 index 00000000000..65d54bf48c0 --- /dev/null +++ b/CHANGES/11363.packaging @@ -0,0 +1,2 @@ +The `blockbuster` test dependency is now optional; the corresponding test fixture is disabled when it is unavailable +-- by :user:`musicinybrain`. diff --git a/tests/conftest.py b/tests/conftest.py index 24c023738da..41ed907ea70 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -12,7 +12,13 @@ from uuid import uuid4 import pytest -from blockbuster import blockbuster_ctx + +try: + from blockbuster import blockbuster_ctx + + HAS_BLOCKBUSTER = True +except ImportError: # For downstreams only # pragma: no cover + HAS_BLOCKBUSTER = False from aiohttp import payload from aiohttp.client_proto import ResponseHandler @@ -46,7 +52,7 @@ IS_LINUX = sys.platform.startswith("linux") -@pytest.fixture(autouse=True) +@pytest.fixture(autouse=HAS_BLOCKBUSTER) def blockbuster(request: pytest.FixtureRequest) -> Iterator[None]: # Allow selectively disabling blockbuster for specific tests # using the @pytest.mark.skip_blockbuster marker.