Skip to content

Commit c9a7472

Browse files
author
Deep PR Forge Local
committed
Fix stdio regression coverage
1 parent 954eafb commit c9a7472

1 file changed

Lines changed: 4 additions & 11 deletions

File tree

tests/server/test_stdio.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -87,17 +87,10 @@ async def test_stdio_server_does_not_close_real_stdio(monkeypatch: pytest.Monkey
8787
await write_stream.aclose()
8888
await read_stream.aclose()
8989

90-
# os.fstat() raises OSError if the fd has been closed; success means the fd
91-
# is still open. A plain `is not None` check would be vacuously true, so we
92-
# use try/except to make the intent explicit.
93-
try:
94-
os.fstat(real_stdin_fd)
95-
except OSError:
96-
pytest.fail("stdio_server() closed the real stdin file descriptor")
97-
try:
98-
os.fstat(real_stdout_fd)
99-
except OSError:
100-
pytest.fail("stdio_server() closed the real stdout file descriptor")
90+
# os.fstat() raises OSError if the fd has been closed; successful calls
91+
# prove stdio_server() did not close the real process descriptors.
92+
os.fstat(real_stdin_fd)
93+
os.fstat(real_stdout_fd)
10194
# The Python wrappers we set as sys.stdin/stdout must not be closed either.
10295
assert not sys.stdin.closed
10396
assert not sys.stdout.closed

0 commit comments

Comments
 (0)