Skip to content

Commit f6d54bf

Browse files
benmosherclaude
andcommitted
✅ Cover line 438: actually stream _bare_stream in openapi schema test
The test only fetched /openapi.json, leaving the generator body unreachable. Add a /stream request inside the same TestClient context so the yield executes, bringing tests/test_sse.py to 100% coverage. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent f8fa20a commit f6d54bf

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

tests/test_sse.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -438,11 +438,14 @@ async def _bare_stream() -> AsyncIterable[ServerSentEvent]:
438438
yield ServerSentEvent(comment="ping")
439439

440440
with TestClient(bare_app) as c:
441-
response = c.get("/openapi.json")
442-
assert response.status_code == 200
443-
schema = response.json()
441+
schema_response = c.get("/openapi.json")
442+
stream_response = c.get("/stream")
443+
assert schema_response.status_code == 200
444+
schema = schema_response.json()
444445
sse_schema = schema["paths"]["/stream"]["get"]["responses"]["200"]["content"][
445446
"text/event-stream"
446447
]["itemSchema"]
447448
assert "required" not in sse_schema
448449
assert "contentSchema" not in sse_schema["properties"]["data"]
450+
assert stream_response.status_code == 200
451+
assert ": ping\n" in stream_response.text

0 commit comments

Comments
 (0)