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?
Per documentation,
conftest.pyrelates only to subfolders, and not to folders in other locations. You can create the submodule tests under the main__tests__folder.