-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Setup httpx_mock via marker instead of fixtures #145
Conversation
We want to be able to configure how the httpx_mock fixture behaves at different scopes. A pytest marker can be used at module, class, or test scope and so is what is used here. Providing a non-default value from the fixtures will emit a DeprecationWarning for each test with the exact marker it can be replaced with: =========================== warnings summary =========================== tests/test_tmp.py::test_a tests/test_tmp.py::test_b /.../pytest_httpx/__init__.py:56: DeprecationWarning: The assert_all_r esponses_were_requested and non_mocked_hosts fixtures are deprecated. Use the following marker instead: pytest.mark.httpx_mock(assert_all_responses_were_requested=False) warnings.warn( tests/test_tmp.py::test_c /.../pytest_httpx/__init__.py:56: DeprecationWarning: The assert_all_r esponses_were_requested and non_mocked_hosts fixtures are deprecated. Use the following marker instead: pytest.mark.httpx_mock(non_mocked_hosts=['example.com']) warnings.warn( Resolves Colin-b#137
ac2edad
to
5b4540f
Compare
Quality Gate passedIssues Measures |
Guys, thank you so much for this pullrequest. It's a great library, but it's a feature it really lacks |
I agree, I plan on looking to this as soon as I have some free time. hang in there |
Quality Gate passedIssues Measures |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thx again for the nice work. I will however drop the support for previous features, this is going to be a breaking change release anyway and changelog + readme document it well enough.
Really nice PR once again, it's refreshing to see actual clean code :)
This was released as part of version 0.31.0 today |
Thanks! |
Resolves #137
We want to be able to configure how the
httpx_mock
fixture behaves at different scopes. A pytest marker can be used at module, class, or test scope and so is what is used here.Providing a non-default value from the fixtures will emit a DeprecationWarning for each test with the exact marker it can be replaced with: