ImportError while loading conftest
knlklabacka opened this issue · 2 comments
knlklabacka commented
I'm having an issue with running tests. Below is the error when running > pytest test/test_login.py
I have compared my files and directory structure to the repo and cannot see what I'm missing.
ImportError while loading conftest 'D:\Documents\Python\PacktFastAPI\planner\tests\conftest.py'.
tests\conftest.py:5: in
from main import app
E ModuleNotFoundError: No module named 'main'
knlklabacka commented
After days of troubleshooting. I cannot get any of the pytest example code from the book to work.
Youngestdev commented
Hi @knlklabacka!
May I confirm that you have created a virtual environment in the base directoy?
Alternatively, you can set the Python path:
set PYTHONPATH=%cd%
Let me know if this helps.