Here is my folder structure
/root
/app
__init__.py
/main.py
/tests
test_something.py (from app.main import ...)
When I run pytest inside /root or /root/tests, I get the error message “cannot import module app”.
I change the folder structure to this and everything works fine.
/root
/app
__init__.py
/main.py
/tests
__init__.py
test_something.py (from app.main import ...)
I want to know how adding this init file revoles pytest import error.