Add regression test for issue #1027#1069
Merged
bhosmer-ant merged 1 commit intofweinberger/align-shutdown-with-specfrom Jul 8, 2025
Merged
Add regression test for issue #1027#1069bhosmer-ant merged 1 commit intofweinberger/align-shutdown-with-specfrom
bhosmer-ant merged 1 commit intofweinberger/align-shutdown-with-specfrom
Conversation
0e4626a to
c032dbc
Compare
2 tasks
1224de0 to
3c8eabe
Compare
7af9e65 to
c9b43bc
Compare
3c8eabe to
72cfeca
Compare
72cfeca to
526d276
Compare
79ebf22 to
34643bd
Compare
This test shows that MCP server cleanup code in lifespan doesn't run when the process is terminated, but does run when stdin is closed first (as implemented in PR #1044). The test includes: - Demonstration of current broken behavior (cleanup doesn't run) - Verification that stdin closure allows graceful shutdown - Windows-specific ResourceWarning handling - Detailed documentation of the issue and solution Github-Issue:#1027
34643bd to
26e1e49
Compare
96b4059
into
fweinberger/align-shutdown-with-spec
10 checks passed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
Issue #1027 reports that MCP server cleanup code (after yield in lifespan) is unreachable when the process is terminated. This PR adds tests that:
How Has This Been Tested?
Added two tests in
test_1027_win_unreachable_cleanup.py:test_lifespan_cleanup_executed- Shows cleanup doesn't run with current termination (xfails)test_stdin_close_triggers_cleanup- Shows cleanup works when stdin is closed first (passes)Tested on both macOS and Windows.
When run with PR #1091's changes, both tests pass.
Breaking Changes
None. Tests only.
Types of changes
Checklist
Additional context