◐ Shell
clean mode source ↗

Flush the stdio subprocess's coverage data before the clean-exit line by maxisbey · Pull Request #2840 · modelcontextprotocol/python-sdk

The stdio interaction test's child only persisted its coverage data in
coverage's atexit hook. On a slow Windows runner the interpreter
teardown plus sqlite save can overrun the transport's termination
grace, and the Job Object kill then silently destroys (or tears) the
data file: every test passes but the 100% gate trips on
_stdio_server.py's subprocess-only lines.

Save the data explicitly before printing the clean-exit line instead.
The test already synchronizes on that line, so once it has been
observed the data is durably on disk and a late kill is harmless. A
kill before the print now fails the stderr assertion loudly instead of
tripping the coverage gate. The trailing lines are excluded (lax no
cover): nothing measured can execute after the flush by construction.

@maxisbey marked this pull request as ready for review

June 11, 2026 22:07

felixweinberger

@maxisbey maxisbey deleted the maxisbey/fix-stdio-subprocess-coverage-race branch

June 12, 2026 09:23