Skip to content
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

Add docs on module level or global pytest fixture configuration #285

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

JacobHayes
Copy link

I wanted to override assert_all_called=True for my entire test suite, but couldn't quite see how from the docs. This PR adds info on how to override the respx_mock fixture at both the module level and globally.

@lundberg
Copy link
Owner

How to globally enable respx is a great suggestion to the docs.

Normally I use an auto-used session scoped fixture for this, e.g. @pytest.fixture(scope="session", autouse=True). An autouse fixture may be simpler a more common test pattern (?).

Maybe the docs on custom fixtures would be a better place to include an example at .. possibly with a link from the guide.

@JacobHayes
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants