ModuleNotFoundError when attempting to import from outside of directory ModuleNotFoundError when attempting to import from outside of directory flask flask

ModuleNotFoundError when attempting to import from outside of directory


You should add __init__.py in your tests directory. The empty __init__.py will turn that directory into a package. Then you can use this line in your test_user_model.py:

from app.models import User

See details in PEP 328.