Title: fix: replace fixed sleeps with polling in flaky TestChildProcessCleanup tests by BabyChrist666 · Pull Request #2071 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: fix: replace fixed sleeps with polling in flaky TestChildProcessCleanup tests by BabyChrist666 · Pull Request #2071 · modelcontextprotocol/python-sdk
X Title: fix: replace fixed sleeps with polling in flaky TestChildProcessCleanup tests by BabyChrist666 · Pull Request #2071 · modelcontextprotocol/python-sdk
Description: Summary Closes #1775 The three tests in TestChildProcessCleanup (test_basic_child_process_cleanup, test_nested_process_tree, test_early_parent_exit) fail intermittently on macOS CI because fixed-duration anyio.sleep() calls (0.5s–1.0s) aren't always enough for child processes to start writing to their marker files on slow CI machines. The assertions then check assert 0 > 0 because the file is still empty. Root cause # Before: fixed sleep that may not be enough on slow CI await anyio.sleep(0.5) initial_size = os.path.getsize(marker_file) await anyio.sleep(0.3) size_after_wait = os.path.getsize(marker_file) assert size_after_wait > initial_size # fails with 0 > 0 Fix Added a _wait_for_file_growth() helper that polls the marker file until it exists, has content, and is actively growing — with a generous 10-second timeout. This eliminates the race condition entirely: # After: poll until file is growing, up to 10s await _wait_for_file_growth(marker_file, "child process") What changed Added _wait_for_file_growth() async helper (polls file size at 0.2s intervals, 10s timeout) Replaced all fixed sleep + assertion blocks in the 3 affected tests with the polling helper Net result: 35 insertions, 32 deletions — simpler and more reliable Test plan ruff lint + format clean pyright clean (0 errors) Tests verified to work on CI (the original tests pass on CI already, this fix prevents the intermittent failures on macOS) 🤖 Generated with Claude Code
Open Graph Description: Summary Closes #1775 The three tests in TestChildProcessCleanup (test_basic_child_process_cleanup, test_nested_process_tree, test_early_parent_exit) fail intermittently on macOS CI because fixed-du...
X Description: Summary Closes #1775 The three tests in TestChildProcessCleanup (test_basic_child_process_cleanup, test_nested_process_tree, test_early_parent_exit) fail intermittently on macOS CI because fixed-du...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/pull/2071
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:23c001bb-c842-cbb2-6832-d44f9ae262fd |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | 9E96:1A7259:1B78A31:24B2E08:6A5BB0F0 |
| html-safe-nonce | d17705adbd646fc20fad09b3d71de6dc4b88494fcde4767a3c8bfc91133d273d |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RTk2OjFBNzI1OToxQjc4QTMxOjI0QjJFMDg6NkE1QkIwRjAiLCJ2aXNpdG9yX2lkIjoiNjM2NDMzNjYzNjExMDI4NzA4OCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 3d8bf089bad5c83d8d5d5fe6ff963b095ec1b2e46af481503d571f4fa7c344b4 |
| hovercard-subject-tag | pull_request:3292138725 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/modelcontextprotocol/python-sdk/pull/2071/files |
| twitter:image | https://avatars.githubusercontent.com/u/251679698?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/251679698?s=400&v=4 |
| og:image:alt | Summary Closes #1775 The three tests in TestChildProcessCleanup (test_basic_child_process_cleanup, test_nested_process_tree, test_early_parent_exit) fail intermittently on macOS CI because fixed-du... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/modelcontextprotocol/python-sdk git https://github.com/modelcontextprotocol/python-sdk.git |
| octolytics-dimension-user_id | 182288589 |
| octolytics-dimension-user_login | modelcontextprotocol |
| octolytics-dimension-repository_id | 862584018 |
| octolytics-dimension-repository_nwo | modelcontextprotocol/python-sdk |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 862584018 |
| octolytics-dimension-repository_network_root_nwo | modelcontextprotocol/python-sdk |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width