mt-kart
|
--> src/data_kart
| |
| --> apis
| | |
| | --> __init__.py
| | --> endpoints.py
| |
| --> models
| | |
| | --> __init__.py
| | --> modelx.py
| |
| --> defaults.py
| --> main.py
--> tests
|
--> __init__.py
|
--> conftest.py
|
--> test_others.py
In main.py
I get module not found error
when I try to refer
from defaults import func1
But this works
from .defaults import func1
It should work without "." right?
2.
From endpoints.py
how should I refer the modelx.py
? My prev. developer had it like below.
from data_kart.models.modelx import model1
But it complains when I run some tests using pytest
from mt-kart
directory. Then the below worked for pytest
. But i am afraid it may give error in some different scenario.
from src.data_kart.models.modelx import model1
The project uses FastApi
and OpenApI Code generators
Edit-------------------
In conftest.py
I added src
to sys.path
and the paths are working fine for my issue 2
.
sys.path.append(os.getcwd()+"/src")