Skip to content

Commit f4d2ea2

Browse files
author
Andrey Barchenkov
committed
fix: add pragma no branch for coverage on reconnection error path
The isinstance check for JSONRPCRequest always evaluates to True because _handle_reconnection is only called for request messages. Mark the branch with pragma: no branch to satisfy 100% branch coverage.
1 parent 3350ca9 commit f4d2ea2

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/mcp/client/streamable_http.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ async def _handle_reconnection(
382382
# Bail if max retries exceeded
383383
if attempt >= MAX_RECONNECTION_ATTEMPTS:
384384
logger.warning(f"Max reconnection attempts ({MAX_RECONNECTION_ATTEMPTS}) exceeded")
385-
if isinstance(ctx.session_message.message, JSONRPCRequest):
385+
if isinstance(ctx.session_message.message, JSONRPCRequest): # pragma: no branch
386386
error_data = ErrorData(
387387
code=INTERNAL_ERROR,
388388
message=f"SSE stream disconnected after {MAX_RECONNECTION_ATTEMPTS} reconnection attempts",

0 commit comments

Comments
 (0)