Skip to content

Commit 3483015

Browse files
committed
ci(#2484): drop pragmas on lines strict-no-cover says are reached
Third CI round: coverage reached 100.00% on the previous commit, but the project also runs ``strict-no-cover`` which complains when a line is marked ``# pragma: no cover`` yet actually gets hit by the test suite (it prevents coverage rot from creeping in under pragma cover). It flagged two of my pragmas: src/mcp/client/stdio.py:161 — `except asyncio.CancelledError:` src/mcp/client/stdio.py:163 — `except anyio.ClosedResourceError:` Both are reached on Linux during the normal teardown of the new stdio tests, so the pragma was wrong. Removed them. (The Windows runs did not hit these branches — which explains why Windows matrix passed last round but Linux did not; strict-no-cover runs on the Linux jobs.) Kept the pragmas on lines 131, 155, 166 — those are the defensive branches that still are not reached by any existing test on either platform and still warrant the marker. 15 stdio tests pass locally; ruff + pyright clean.
1 parent 618be64 commit 3483015

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/mcp/client/stdio.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@ def _on_done(task: asyncio.Task[None]) -> None:
158158
for task in tasks:
159159
try:
160160
await task
161-
except asyncio.CancelledError: # pragma: no cover - only if a task was still pending above
161+
except asyncio.CancelledError:
162162
pass
163-
except anyio.ClosedResourceError: # pragma: no cover - swallowed by reader/writer already
163+
except anyio.ClosedResourceError:
164164
pass
165165
except BaseException as exc: # noqa: BLE001
166166
if pending_exc is None: # pragma: no branch

0 commit comments

Comments
 (0)