Skip to content

Commit 8b118f8

Browse files
committed
Match Starlette's BlockBuster fixture pattern
1 parent ca72543 commit 8b118f8

3 files changed

Lines changed: 14 additions & 17 deletions

File tree

‎pyproject.toml‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,7 @@ dev = [
7777
"strict-no-cover",
7878
"logfire>=3.0.0",
7979
"opentelemetry-sdk>=1.39.1",
80-
# BlockBuster minor releases may add breaking detection rules.
81-
"blockbuster>=1.5.26,<1.6",
80+
"blockbuster>=1.5.23",
8281
]
8382
docs = [
8483
# Zensical is the Material team's successor to MkDocs; it natively

‎tests/conftest.py‎

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,21 @@ def anyio_backend() -> str:
2828
return "asyncio"
2929

3030

31-
_BLOCKBUSTER = BlockBuster(["mcp", "mcp_types"])
32-
# Coverage reads source files while collecting data.
33-
_BLOCKBUSTER.functions["os.stat"].can_block_in("coverage/python.py", "get_python_source")
34-
_BLOCKBUSTER.functions["io.BufferedReader.read"].can_block_in("coverage/python.py", "read_python_source")
35-
# These public synchronous conversions read the media file by design.
36-
_BLOCKBUSTER.functions["io.BufferedReader.read"].can_block_in(
37-
"mcp/server/mcpserver/utilities/types.py", ("to_image_content", "to_audio_content")
38-
)
39-
40-
4131
@pytest.fixture(autouse=True)
42-
def blockbuster() -> Iterator[BlockBuster]:
32+
def blockbuster() -> Iterator[None]:
33+
bb = BlockBuster(["mcp", "mcp_types"])
34+
# Coverage reads source files while collecting data.
35+
bb.functions["os.stat"].can_block_in("coverage/python.py", "get_python_source")
36+
bb.functions["io.BufferedReader.read"].can_block_in("coverage/python.py", "read_python_source")
37+
# These public synchronous conversions read the media file by design.
38+
bb.functions["io.BufferedReader.read"].can_block_in(
39+
"mcp/server/mcpserver/utilities/types.py", ("to_image_content", "to_audio_content")
40+
)
41+
bb.activate()
4342
try:
44-
_BLOCKBUSTER.activate()
45-
yield _BLOCKBUSTER
43+
yield
4644
finally:
47-
_BLOCKBUSTER.deactivate()
45+
bb.deactivate()
4846

4947

5048
@pytest.fixture(scope="module", autouse=True)

‎uv.lock‎

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)