Skip to content

Commit 29a5b8f

Browse files
lesnik512claude
andcommitted
test: drop redundant pytest.fail() pragmas (now globally excluded)
The coverage.report.exclude_also pattern added for pytest.fail() makes the per-line `# pragma: no cover` comments on those lines redundant; remove the 14 in the stream test files. Other (non-pytest.fail) pragmas are unaffected. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 3adfd9a commit 29a5b8f

2 files changed

Lines changed: 14 additions & 14 deletions

File tree

‎tests/test_client_stream.py‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def handler(request: httpx2.Request) -> httpx2.Response:
5757
client = _client(handler)
5858
with pytest.raises(NotFoundError) as info:
5959
async with client.stream("GET", "https://example.test/missing"):
60-
pytest.fail("should have raised before reaching block body") # pragma: no cover
60+
pytest.fail("should have raised before reaching block body")
6161
assert info.value.response.status_code == _NOT_FOUND
6262
assert info.value.response.content == body # body was pre-read; accessible
6363

@@ -71,7 +71,7 @@ def handler(request: httpx2.Request) -> httpx2.Response:
7171
client = _client(handler)
7272
with pytest.raises(ServiceUnavailableError) as info:
7373
async with client.stream("GET", "https://example.test/x"):
74-
pytest.fail("unreachable") # pragma: no cover
74+
pytest.fail("unreachable")
7575
assert info.value.response.content == body
7676

7777

@@ -82,7 +82,7 @@ def handler(request: httpx2.Request) -> httpx2.Response:
8282
client = _client(handler)
8383
with pytest.raises(ClientStatusError) as info:
8484
async with client.stream("GET", "https://example.test/x"):
85-
pytest.fail("unreachable") # pragma: no cover
85+
pytest.fail("unreachable")
8686
assert type(info.value) is ClientStatusError
8787
assert info.value.response.status_code == _UNKNOWN_4XX
8888

@@ -94,7 +94,7 @@ def handler(request: httpx2.Request) -> httpx2.Response:
9494
client = _client(handler)
9595
with pytest.raises(ServerStatusError) as info:
9696
async with client.stream("GET", "https://example.test/x"):
97-
pytest.fail("unreachable") # pragma: no cover
97+
pytest.fail("unreachable")
9898
assert type(info.value) is ServerStatusError
9999
assert info.value.response.status_code == _UNKNOWN_5XX
100100

@@ -116,7 +116,7 @@ def handler(request: httpx2.Request) -> httpx2.Response: # noqa: ARG001
116116
client = _client(handler)
117117
with pytest.raises(NetworkError, match="connect refused"):
118118
async with client.stream("GET", "https://example.test/x"):
119-
pytest.fail("unreachable") # pragma: no cover
119+
pytest.fail("unreachable")
120120

121121

122122
async def test_network_error_during_body_consumption_maps_to_network_error() -> None:
@@ -147,7 +147,7 @@ def handler(request: httpx2.Request) -> httpx2.Response: # noqa: ARG001
147147
client = _client(handler)
148148
with pytest.raises(HttpwareTimeoutError, match="read timeout"):
149149
async with client.stream("GET", "https://example.test/x"):
150-
pytest.fail("unreachable") # pragma: no cover
150+
pytest.fail("unreachable")
151151

152152

153153
async def test_invalid_url_maps_to_bare_transport_error() -> None:
@@ -158,7 +158,7 @@ def handler(request: httpx2.Request) -> httpx2.Response: # noqa: ARG001
158158
client = _client(handler)
159159
with pytest.raises(TransportError) as info:
160160
async with client.stream("GET", "https://example.test/x"):
161-
pytest.fail("unreachable") # pragma: no cover
161+
pytest.fail("unreachable")
162162
assert not isinstance(info.value, NetworkError)
163163

164164

‎tests/test_client_stream_sync.py‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def handler(request: httpx2.Request) -> httpx2.Response:
5454

5555
client = _client(handler)
5656
with pytest.raises(NotFoundError) as info, client.stream("GET", "https://example.test/missing"):
57-
pytest.fail("should have raised before reaching block body") # pragma: no cover
57+
pytest.fail("should have raised before reaching block body")
5858
assert info.value.response.status_code == _NOT_FOUND
5959
assert info.value.response.content == body # body was pre-read; accessible
6060

@@ -67,7 +67,7 @@ def handler(request: httpx2.Request) -> httpx2.Response:
6767

6868
client = _client(handler)
6969
with pytest.raises(ServiceUnavailableError) as info, client.stream("GET", "https://example.test/x"):
70-
pytest.fail("unreachable") # pragma: no cover
70+
pytest.fail("unreachable")
7171
assert info.value.response.content == body
7272

7373

@@ -77,7 +77,7 @@ def handler(request: httpx2.Request) -> httpx2.Response:
7777

7878
client = _client(handler)
7979
with pytest.raises(ClientStatusError) as info, client.stream("GET", "https://example.test/x"):
80-
pytest.fail("unreachable") # pragma: no cover
80+
pytest.fail("unreachable")
8181
assert type(info.value) is ClientStatusError
8282
assert info.value.response.status_code == _UNKNOWN_4XX
8383

@@ -88,7 +88,7 @@ def handler(request: httpx2.Request) -> httpx2.Response:
8888

8989
client = _client(handler)
9090
with pytest.raises(ServerStatusError) as info, client.stream("GET", "https://example.test/x"):
91-
pytest.fail("unreachable") # pragma: no cover
91+
pytest.fail("unreachable")
9292
assert type(info.value) is ServerStatusError
9393
assert info.value.response.status_code == _UNKNOWN_5XX
9494

@@ -109,7 +109,7 @@ def handler(request: httpx2.Request) -> httpx2.Response: # noqa: ARG001
109109

110110
client = _client(handler)
111111
with pytest.raises(NetworkError, match="connect refused"), client.stream("GET", "https://example.test/x"):
112-
pytest.fail("unreachable") # pragma: no cover
112+
pytest.fail("unreachable")
113113

114114

115115
def test_network_error_during_body_consumption_maps_to_network_error() -> None:
@@ -139,7 +139,7 @@ def handler(request: httpx2.Request) -> httpx2.Response: # noqa: ARG001
139139

140140
client = _client(handler)
141141
with pytest.raises(HttpwareTimeoutError, match="read timeout"), client.stream("GET", "https://example.test/x"):
142-
pytest.fail("unreachable") # pragma: no cover
142+
pytest.fail("unreachable")
143143

144144

145145
def test_invalid_url_maps_to_bare_transport_error() -> None:
@@ -149,7 +149,7 @@ def handler(request: httpx2.Request) -> httpx2.Response: # noqa: ARG001
149149

150150
client = _client(handler)
151151
with pytest.raises(TransportError) as info, client.stream("GET", "https://example.test/x"):
152-
pytest.fail("unreachable") # pragma: no cover
152+
pytest.fail("unreachable")
153153
assert not isinstance(info.value, NetworkError)
154154

155155

0 commit comments

Comments
 (0)