In my project I have the following folder structure:
mymodule/
main.py
tests/
test_main.py
where test_main.py
looks like this:
from .mymodule.main import myfunc
def test_myfunc():
res = myfunc()
assert res > 1
I want to test it with pytest, but when I call pytest
in the parent folder (above mymodule
and test
), I get `ImportError: cannot import
I tried a trick with
import sys
sys.path.insert(0, '/path/to/application/app/folder')
but it doesn't work either.
I'm using Python 3.9.4.