Skip to content

Commit 41f3ba8

Browse files
committed
test: tolerate dependency stderr warnings
1 parent 78fea11 commit 41f3ba8

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

‎tests/interaction/transports/test_stdio.py‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import sys
1010
import tempfile
1111
from pathlib import Path
12+
from typing import TextIO, cast
1213

1314
import anyio
1415
import pytest
@@ -62,7 +63,7 @@ async def collect(params: LoggingMessageNotificationParams) -> None:
6263
env={key: value for key, value in os.environ.items() if key.startswith("COVERAGE_")}
6364
| {"PYTHONWARNINGS": "ignore::SyntaxWarning"},
6465
),
65-
errlog=errlog,
66+
errlog=cast(TextIO, errlog),
6667
)
6768

6869
# Must exceed session time plus the patched PROCESS_TERMINATION_TIMEOUT (20s).
@@ -80,8 +81,12 @@ async def collect(params: LoggingMessageNotificationParams) -> None:
8081
assert received == snapshot(
8182
[LoggingMessageNotificationParams(level="info", logger="echo", data="echoing across\nprocesses")]
8283
)
83-
# The marker distinguishes clean exit from termination.
84-
assert captured_stderr == snapshot("stdio-echo: clean exit\n")
84+
# The server writes this line only after its run loop returns, which happens when stdin closes:
85+
# seeing it proves the process exited on its own rather than via the transport's terminate
86+
# escalation, without a timing-based assertion. The capture itself proves stderr passthrough:
87+
# the transport routes the child's stderr to the caller's `errlog` without consuming it.
88+
# Prerelease Python/lowest-direct dependency runs may print warnings before the server marker.
89+
assert captured_stderr.endswith("stdio-echo: clean exit\n")
8590

8691

8792
@requirement("transport:stdio:stream-purity")

0 commit comments

Comments
 (0)