Skip to content

Commit 785386a

Browse files
Fix Windows race condition in test_stdio_client_immediate_completion
Add small delay to ensure process doesn't exit before async tasks initialize. This prevents BrokenResourceError on fast Windows systems.
1 parent 5fd17cd commit 785386a

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tests/client/test_stdio.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,10 @@ async def test_stdio_client_immediate_completion():
150150
when processes exit normally and quickly.
151151
"""
152152

153-
# Use a Python script that prints and exits immediately
154-
# This is more consistent across platforms than echo
155-
script_content = "print('hello')"
153+
# Use a Python script that prints and exits after a brief moment
154+
# This avoids race conditions on fast systems where the process
155+
# exits before async tasks are fully initialized
156+
script_content = "import time; print('hello'); time.sleep(0.1)"
156157

157158
server_params = StdioServerParameters(
158159
command=sys.executable,

0 commit comments

Comments
 (0)