Skip to content

Commit 9d42000

Browse files
committed
test: tolerate dependency stderr warnings
1 parent bc50210 commit 9d42000

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

tests/interaction/transports/test_stdio.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
import sys
1717
import tempfile
1818
from pathlib import Path
19+
from typing import TextIO, cast
1920

2021
import anyio
2122
import 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\nprocesses")]
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

Comments
 (0)