v0.31.0
版本发布时间: 2024-09-20 18:38:08
Colin-b/pytest_httpx最新发布版本:v0.31.2(2024-09-24 01:21:15)
Changed
- Tests will now fail at teardown by default if some requests were issued but were not matched.
- This behavior can be changed thanks to the new
pytest.mark.httpx_mock(assert_all_requests_were_expected=False)
option.
- This behavior can be changed thanks to the new
- The
httpx_mock
fixture is now configured using a marker (many thanks toFrazer McLean
).# Apply marker to whole module pytestmark = pytest.mark.httpx_mock(assert_all_responses_were_requested=False) # Or to specific tests @pytest.mark.httpx_mock(non_mocked_hosts=[...]) def test_foo(httpx_mock): ...
- The following options are available:
-
assert_all_responses_were_requested
(boolean), defaulting toTrue
. -
assert_all_requests_were_expected
(boolean), defaulting toTrue
. -
non_mocked_hosts
(iterable), defaulting to an empty list, meaning all hosts are mocked.
-
- The following options are available:
-
httpx_mock.reset
do not expect any parameter anymore and will only reset the mock state (no assertions will be performed).
Removed
-
pytest
7
is not supported anymore (pytest
8
has been out for 9 months already). -
assert_all_responses_were_requested
fixture is not available anymore, usepytest.mark.httpx_mock(assert_all_responses_were_requested=False)
instead. -
non_mocked_hosts
fixture is not available anymore, usepytest.mark.httpx_mock(non_mocked_hosts=[])
instead.