Deflake the issue-1363 tests: wait for lifespan startup instead of sleeping by maxisbey · Pull Request #2879 · modelcontextprotocol/python-sdk
…eeping The three tests in test_1363_race_condition_streamable_http.py waited a fixed 0.1s for the ServerThread to start the app lifespan before sending requests. On a loaded CI runner the thread is sometimes not ready in time, so the first request reaches handle_request() before the session manager's task group exists and the test fails with "RuntimeError: Task group is not initialized" (seen intermittently on both Ubuntu and Windows jobs). Replace the fixed sleep with a threading.Event that the server thread sets once lifespan startup has completed; the tests wait for it (bounded at 5s) before sending the first request.
marked this pull request as ready for review
maxisbey
deleted the
maxisbey/deflake-1363-startup-handshake
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