1616import sys
1717import tempfile
1818from pathlib import Path
19+ from typing import TextIO , cast
1920
2021import anyio
2122import pytest
@@ -80,7 +81,7 @@ async def collect(params: LoggingMessageNotificationParams) -> None:
8081 env = {key : value for key , value in os .environ .items () if key .startswith ("COVERAGE_" )}
8182 | {"PYTHONWARNINGS" : "ignore::SyntaxWarning" },
8283 ),
83- errlog = errlog ,
84+ errlog = cast ( TextIO , errlog ) ,
8485 )
8586
8687 # Must exceed session time plus the patched PROCESS_TERMINATION_TIMEOUT (10s).
@@ -98,9 +99,12 @@ async def collect(params: LoggingMessageNotificationParams) -> None:
9899 assert received == snapshot (
99100 [LoggingMessageNotificationParams (level = "info" , logger = "echo" , data = "echoing across\n processes" )]
100101 )
101- # The server writes this line only after its run loop returns on stdin close: seeing it proves
102- # a self-exit, not the terminate escalation. The capture itself proves stderr passthrough.
103- assert captured_stderr == snapshot ("stdio-echo: clean exit\n " )
102+ # The server writes this line only after its run loop returns, which happens when stdin closes:
103+ # seeing it proves the process exited on its own rather than via the transport's terminate
104+ # escalation, without a timing-based assertion. The capture itself proves stderr passthrough:
105+ # the transport routes the child's stderr to the caller's `errlog` without consuming it.
106+ # Prerelease Python/lowest-direct dependency runs may print warnings before the server marker.
107+ assert captured_stderr .endswith ("stdio-echo: clean exit\n " )
104108
105109
106110@requirement ("transport:stdio:stream-purity" )
0 commit comments