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.
marked this pull request as ready for review
maxisbey
deleted the
maxisbey/fix-stdio-subprocess-coverage-race
branch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters