Fixtures in multiple conftest files run in nested order #8475
Unanswered
guy-saban-ws
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I have the following project structure
I have a fixture I want to run for every Tests_ folder (
TestsA
andTestsB
), so I created a fixture with scope packageWhen added in
conftest.py
under Tests it runs only ones although I added__init__.py
file toTestsA
andTestsB
to make them a package.When I added a
conftest.py
with the fixture to each of the Tests_ folders both executed the setup code before the tests under it, but executed the teardown code only after all the tests finished, and as if they were executed as nested:Which causes some issues, especially since I have more than two Tests_ folders.
Why does it behave like this, and more important how can I solve it without flattening the test hierarchy or adding
conftest.py
to every SubFolder.I'm using Python 3.8 and Pytest 6.2.2 if it makes any difference.
Beta Was this translation helpful? Give feedback.
All reactions