You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit was created on GitHub.com and signed with GitHub’s verified signature.
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.
The httpx_mock fixture is now configured using a marker (many thanks to Frazer McLean).
# Apply marker to whole modulepytestmark=pytest.mark.httpx_mock(assert_all_responses_were_requested=False)
# Or to specific tests@pytest.mark.httpx_mock(non_mocked_hosts=[...])deftest_foo(httpx_mock):
...
The following options are available:
assert_all_responses_were_requested (boolean), defaulting to True.
assert_all_requests_were_expected (boolean), defaulting to True.
non_mocked_hosts (iterable), defaulting to an empty list, meaning all hosts are mocked.
httpx_mock.reset do not expect any parameter anymore and will only reset the mock state (no assertions will be performed).
Removed
pytest7 is not supported anymore (pytest8 has been out for 9 months already).
assert_all_responses_were_requested fixture is not available anymore, use pytest.mark.httpx_mock(assert_all_responses_were_requested=False) instead.
non_mocked_hosts fixture is not available anymore, use pytest.mark.httpx_mock(non_mocked_hosts=[]) instead.