Skip to content

Commit ac4c2ac

Browse files
committed
test: fix branch coverage on Python 3.11/3.14
Add pragma: no branch to async with ClientSession in notification error test — the exception exit branch of the context manager is never taken and coverage.py reports it differently across Python versions.
1 parent 855bb6e commit ac4c2ac

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tests/client/test_notification_response.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ async def test_http_error_on_notification_does_not_hang() -> None:
161161
app = _create_http_error_app(500, error_on_notifications=True)
162162
async with httpx.AsyncClient(transport=httpx.ASGITransport(app=app)) as client:
163163
async with streamable_http_client("http://localhost/mcp", http_client=client) as (read_stream, write_stream):
164-
async with ClientSession(read_stream, write_stream) as session:
164+
async with ClientSession(read_stream, write_stream) as session: # pragma: no branch
165165
await session.initialize()
166166

167167
# Should not raise or hang — the error is silently ignored for notifications

0 commit comments

Comments
 (0)