I have a project with a structure like this:
readme.md
requirements.txt
project/
main.py
helpers.py
recording.py
I want to write some tests, for example test_helpers.py
that will test the functionaility in helpers.py
I tried doing it like this:
readme.md
requirements.txt
project/
__init__.py
main.py
helpers.py
recording.py
tests/
test_helpers.py
and in test_helpers.py
:
from ..project import helpers
But this throws an error:
ImportError: attempted relative import with no known parent package
How would I go about importing things correctly?
I'm aware that I can add the directory using sys.path.insert
but that seems quite hacky considering I would have to do it for every test*.py file?