Skip to content

Commit b04f535

Browse files
steps-reclaude
andcommitted
test(stdio): close streams explicitly to satisfy 100% branch coverage
The bare `async with read_stream, write_stream: pass` left an uncovered exceptional-exit arc, failing the repo 100% coverage gate (surfaced on the 3.14 CI shard). Replace with explicit aclose() calls in both stdio server tests. Streams/behavior unchanged. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 9a57007 commit b04f535

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

tests/server/test_stdio.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,11 @@ async def test_stdio_server_does_not_close_real_std_handles(monkeypatch: pytest.
103103

104104
with anyio.fail_after(5):
105105
async with stdio_server() as (read_stream, write_stream):
106-
async with read_stream, write_stream:
107-
pass
106+
# Close the streams so the reader/writer tasks unwind and the
107+
# server context exits (explicit aclose keeps this branch-free
108+
# for the repo's 100% coverage gate).
109+
await read_stream.aclose()
110+
await write_stream.aclose()
108111

109112
# Force finalization of any TextIOWrapper the server created internally.
110113
gc.collect()
@@ -132,8 +135,8 @@ async def test_stdio_server_bufferless_text_streams(monkeypatch: pytest.MonkeyPa
132135

133136
with anyio.fail_after(5):
134137
async with stdio_server() as (read_stream, write_stream):
135-
async with read_stream, write_stream:
136-
pass
138+
await read_stream.aclose()
139+
await write_stream.aclose()
137140

138141

139142
@pytest.mark.anyio

0 commit comments

Comments
 (0)