From f6d54bf36f422838e705553ede875b3fa946dbbe Mon Sep 17 00:00:00 2001 From: Ben Mosher Date: Sun, 22 Mar 2026 16:01:09 -0400 Subject: [PATCH] =?UTF-8?q?=E2=9C=85=20Cover=20line=20438:=20actually=20st?= =?UTF-8?q?ream=20=5Fbare=5Fstream=20in=20openapi=20schema=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- tests/test_sse.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/tests/test_sse.py b/tests/test_sse.py index 8866a669e1..9b762b111e 100644 --- a/tests/test_sse.py +++ b/tests/test_sse.py @@ -438,11 +438,14 @@ def test_bare_sse_openapi_has_no_content_schema(): yield ServerSentEvent(comment="ping") with TestClient(bare_app) as c: - response = c.get("/openapi.json") - assert response.status_code == 200 - schema = response.json() + schema_response = c.get("/openapi.json") + stream_response = c.get("/stream") + assert schema_response.status_code == 200 + schema = schema_response.json() sse_schema = schema["paths"]["/stream"]["get"]["responses"]["200"]["content"][ "text/event-stream" ]["itemSchema"] assert "required" not in sse_schema assert "contentSchema" not in sse_schema["properties"]["data"] + assert stream_response.status_code == 200 + assert ": ping\n" in stream_response.text