Skip to content

Commit 8c23503

Browse files
lesnik512claude
andcommitted
test(stream): mark unreachable stream-body lines no-cover
The new bounded-error-body tests raise on stream enter, so the `async with` body never runs. Match the file's existing idiom (pytest.fail(...) # pragma: no cover) to restore 100% line coverage. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent a355b2f commit 8c23503

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

tests/test_client_stream.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ def handler(request: httpx2.Request) -> httpx2.Response: # noqa: ARG001
351351
)
352352
with pytest.raises(ResponseTooLargeError) as caught:
353353
async with client.stream("GET", "https://example.test/x"):
354-
pass
354+
pytest.fail("unreachable") # pragma: no cover
355355
assert caught.value.limit == 10 # noqa: PLR2004 — mirrors max_error_body_bytes above
356356
assert caught.value.content_length == 200 # noqa: PLR2004 — len(body) above
357357
await client.aclose()
@@ -368,7 +368,7 @@ def handler(request: httpx2.Request) -> httpx2.Response: # noqa: ARG001
368368
)
369369
with pytest.raises(NotFoundError) as caught:
370370
async with client.stream("GET", "https://example.test/x"):
371-
pass
371+
pytest.fail("unreachable") # pragma: no cover
372372
assert caught.value.response.content == body
373373
await client.aclose()
374374

@@ -382,7 +382,7 @@ def handler(request: httpx2.Request) -> httpx2.Response: # noqa: ARG001
382382
client = AsyncClient(httpx2_client=httpx2.AsyncClient(transport=httpx2.MockTransport(handler)))
383383
with pytest.raises(InternalServerError) as caught:
384384
async with client.stream("GET", "https://example.test/x"):
385-
pass
385+
pytest.fail("unreachable") # pragma: no cover
386386
assert caught.value.response.content == body
387387
await client.aclose()
388388

tests/test_client_stream_sync.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ def handler(request: httpx2.Request) -> httpx2.Response: # noqa: ARG001
316316

317317
client = Client(httpx2_client=httpx2.Client(transport=httpx2.MockTransport(handler)), max_error_body_bytes=10)
318318
with pytest.raises(ResponseTooLargeError) as caught, client.stream("GET", "https://example.test/x"):
319-
pass
319+
pytest.fail("unreachable") # pragma: no cover
320320
assert caught.value.limit == 10 # noqa: PLR2004 — mirrors max_error_body_bytes above
321321
assert caught.value.content_length == 200 # noqa: PLR2004 — len(body) above
322322
client.close()
@@ -330,7 +330,7 @@ def handler(request: httpx2.Request) -> httpx2.Response: # noqa: ARG001
330330

331331
client = Client(httpx2_client=httpx2.Client(transport=httpx2.MockTransport(handler)), max_error_body_bytes=1000)
332332
with pytest.raises(NotFoundError) as caught, client.stream("GET", "https://example.test/x"):
333-
pass
333+
pytest.fail("unreachable") # pragma: no cover
334334
assert caught.value.response.content == body
335335
client.close()
336336

@@ -343,6 +343,6 @@ def handler(request: httpx2.Request) -> httpx2.Response: # noqa: ARG001
343343

344344
client = Client(httpx2_client=httpx2.Client(transport=httpx2.MockTransport(handler)))
345345
with pytest.raises(InternalServerError) as caught, client.stream("GET", "https://example.test/x"):
346-
pass
346+
pytest.fail("unreachable") # pragma: no cover
347347
assert caught.value.response.content == body
348348
client.close()

0 commit comments

Comments
 (0)