Reputation: 4245
I'm using pytest and decided to go with Tests as part of application code pattern. Everything works fine besides conftest discovery.
I have the following structure:
module_a/
a.py
__tests__/
conftest.py
test_a.py
submodule/
b.py
__tests__/
test_b.py
In conftest.py
under module_a/__tests__
I define fixtures that I want to be able to use in module_a/submodule/__tests__
, but it doesn't discover that.
If I move the conftest.py
to module_a
(not inside __tests__
), it works, but I dont want to define it outside of the __tests__
directory.
Any idea how can I achieve this?
Upvotes: -1
Views: 97
Reputation: 26900
Per documentation, conftest.py
relates only to subfolders, and not to folders in other locations. You can create the submodule tests under the main __tests__
folder.
Upvotes: 0