Skip to content

Commit ae3ebc8

Browse files
committed
fix: add missing pragma no branch annotations for CI coverage
Branch coverage on Python 3.11 and 3.14 tracks implicit exception paths through `async with` and `with pytest.raises(...)` differently, causing coverage to drop below 100%. Add `pragma: no branch` to suppress these false positives, matching the pattern used elsewhere in the test suite.
1 parent 458950c commit ae3ebc8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/client/test_notification_response.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,10 @@ async def test_unexpected_content_type_sends_jsonrpc_error() -> None:
109109
"""
110110
async with httpx.AsyncClient(transport=httpx.ASGITransport(app=_create_unexpected_content_type_app())) as client:
111111
async with streamable_http_client("http://localhost/mcp", http_client=client) as (read_stream, write_stream):
112-
async with ClientSession(read_stream, write_stream) as session:
112+
async with ClientSession(read_stream, write_stream) as session: # pragma: no branch
113113
await session.initialize()
114114

115-
with pytest.raises(MCPError, match="Unexpected content type: text/plain"):
115+
with pytest.raises(MCPError, match="Unexpected content type: text/plain"): # pragma: no branch
116116
await session.list_tools()
117117

118118

@@ -144,8 +144,8 @@ async def test_invalid_json_response_sends_jsonrpc_error() -> None:
144144
"""
145145
async with httpx.AsyncClient(transport=httpx.ASGITransport(app=_create_invalid_json_response_app())) as client:
146146
async with streamable_http_client("http://localhost/mcp", http_client=client) as (read_stream, write_stream):
147-
async with ClientSession(read_stream, write_stream) as session:
147+
async with ClientSession(read_stream, write_stream) as session: # pragma: no branch
148148
await session.initialize()
149149

150-
with pytest.raises(MCPError, match="Failed to parse JSON response"):
150+
with pytest.raises(MCPError, match="Failed to parse JSON response"): # pragma: no branch
151151
await session.list_tools()

0 commit comments

Comments
 (0)