When performing unit tests we usually import modules in project-directory/src
. For this to work, we have to make sure sys.path
contains our project-directory
when running pytest
, so that
from src.utils.module_name import SomeClass
becomes possible. It is as simple as executing (instead of pytest -vv test/...
)
python -m pytest -vv test/...
and make sure we have cd
ed into project directory when running this script.