Unify the conftest imports and set the import mode to discover them #1089
+6
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The tests have two ways of importing from conftest: directly and via tests.conftest.
In Fedora I've encountered issues with running tests of 5.0.0 during the build.
When running the tests directly via
pytest, the output is:When running with
pytest --import-mode=importlib, other tests raise ImportError:It's not possible to fix everything so that the direct imports from conftest are applied, because there are two conftest.py files present in the repository at different locations.
The fix applied imports from
tests.conftesteverywhere, which also requires a change in the import mode, added to pyproject.toml. The end result works consistently when invoked just withpytest.