Skip to content

Commit b977b52

Browse files
adamtheturtleclaude
andcommitted
Assert httpx mock routes are called in transport tests
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent e2bf8ce commit b977b52

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

tests/test_transports.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class TestHTTPXTransport:
1616
@respx.mock
1717
def test_float_timeout() -> None:
1818
"""``HTTPXTransport`` works with a float timeout."""
19-
respx.post(url="https://example.com/test").mock(
19+
route = respx.post(url="https://example.com/test").mock(
2020
return_value=httpx.Response(
2121
status_code=HTTPStatus.OK,
2222
text="OK",
@@ -30,6 +30,7 @@ def test_float_timeout() -> None:
3030
data=b"hello",
3131
timeout=30.0,
3232
)
33+
assert route.called
3334
assert isinstance(response, Response)
3435
assert response.status_code == HTTPStatus.OK
3536
assert response.text == "OK"
@@ -41,7 +42,7 @@ def test_tuple_timeout() -> None:
4142
"""``HTTPXTransport`` works with a (connect, read) timeout
4243
tuple.
4344
"""
44-
respx.post(url="https://example.com/test").mock(
45+
route = respx.post(url="https://example.com/test").mock(
4546
return_value=httpx.Response(
4647
status_code=HTTPStatus.OK,
4748
text="OK",
@@ -55,5 +56,6 @@ def test_tuple_timeout() -> None:
5556
data=b"hello",
5657
timeout=(5.0, 30.0),
5758
)
59+
assert route.called
5860
assert isinstance(response, Response)
5961
assert response.status_code == HTTPStatus.OK

0 commit comments

Comments
 (0)