Add docs on module level or global pytest fixture configuration#285
Add docs on module level or global pytest fixture configuration#285JacobHayes wants to merge 1 commit intolundberg:masterfrom
Conversation
|
How to globally enable Normally I use an auto-used session scoped fixture for this, e.g. Maybe the docs on custom fixtures would be a better place to include an example at .. possibly with a link from the guide. |
|
Hmm yeah an autouse fixture is probably better for most uses. In my case, I didn't want to affect httpx in tests that weren't otherwise mocking, so an autouse fixture (which would add mocking) wasn't ideal. |
|
Well, mocking httpx for the test suite globally is preferred, preventing any external unwanted/accidental calls to be made .. at least IMO 😉 i.e. it's a good workflow when the test suite is able to run anywhere, without remote access. |
|
BTW, the idea behind #227 is to allow the user to configure respx's default response/sideeffect e.g. |
I wanted to override
assert_all_called=Truefor my entire test suite, but couldn't quite see how from the docs. This PR adds info on how to override therespx_mockfixture at both the module level and globally.