My proj structure is like this:
app/
src
resources
__init__.py (contains foo method)
tests
resources
__init__.py
sometest.py
when I start sometest.py, as part of the imports, it eventually gets to this line located in src/core/some_module.py:
from resources import foo
when I run the test with pytest i get:
ImportError: cannot import name 'foo' from 'resources' (app/tests/resources/__init__.py)
If I explicitly change the import statement to:
from src.resources import foo
than it works, but for some reason ONLY when I run it via pycharm's UI, and if I try running:
poetry run pytest -ra --cov=src --cov-fail-under=80 --cov-config=.coveragerc
it fails with:
ModuleNotFoundError: No module named 'src'
can anyone explain what's happening here and how can I solve it so that the tests imports the foo that's inside /app/src ?