When the project directory and a subfolder has the same name, I get an import error when running pytest.
I have tried to rename the subfolder and then there is no problem.
For example with the following folder structure:
- project/
- project/
- tools.py
- foo/
- foofile.py
- bar/
- unittest/
- test_foofile.py
- project/
In project/foo/foofile.py we try to import classes from project/project/tools.py:
from project.tools import ClassA
When then running python -m pytest
from the first level directory project/ i get the following error:
ImportError: cannot import name 'ClassA' from 'project.tools' (unknown location)
Is there a way to say to the interpreter that it should look into the subfolder project?