Move pytest fixtures to ``conftest.py``
See original GitHub issueDescription
Pytest fixtures are best defined in a conftest.py
, in whatever subpackage the tests are for. This has a number of advantages, not least of which is avoiding the annoying way that pytest is not compliant with F401 issues (See #13853).
Additional context
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:12 (12 by maintainers)
Top Results From Across the Web
How to modularize your py.test fixtures - GitHub Gist
You can simply create "local pytest plugins" which can be nothing more than Python files with fixtures, e.g.. tests/unit/conftest.py: pytest_plugins = [ "tests....
Read more >pytest fixtures: explicit, modular, scalable
The conftest.py file serves as a means of providing fixtures for an entire directory. Fixtures defined in a conftest.py can be used by...
Read more >In pytest, what is the use of conftest.py files? - Stack Overflow
Yes it is. Fixtures are a potential and common use of conftest.py . The fixtures that you will define will be shared among...
Read more >Using Pytest Fixtures: A Step-by-Step Guide With Examples
In this step-by-step guide, we will go through a quick setup for Pytest with Fixtures and different types of fixtures.
Read more >Pytest Tutorial: Sharing Fixtures Through conftest - YouTube
Pytest Tutorial: Sharing Fixtures Through conftest Pytest fixtures are one of the core features that make pytest framework stand out above ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I disagree with this as a general policy. If a fixture is only used in a single test file, then I think it’s much easier to read if you don’t have to go and open a second file to find the fixture.
Why was that done in a PR named “Pre commit flake8s” amongst hundred of lines changed ? (#13853)