Skip to content

ImportError when running tests #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
alv2017 opened this issue Feb 9, 2025 · 0 comments
Open

ImportError when running tests #2

alv2017 opened this issue Feb 9, 2025 · 0 comments

Comments

@alv2017
Copy link

alv2017 commented Feb 9, 2025

When I run the commands below (as per tutorial instructions)

$ cd user_manager  
$ poetry run pytest tests/test_user_manager.py  -v -s

and

$ poetry run pytest tests/mocking/test_user_manager_mocked.py -v -s

I get an ImportError:

ImportError while loading conftest '/home/user/LearningFlask/pytest-flask-sqlalchemy-example/user_manager/tests/conftest.py'.
tests/conftest.py:6: in <module>
    from user_manager.app import create_app
E   ModuleNotFoundError: No module named 'user_manager'

There are a couple of ways to fix this issue with imports, but it requires quite significant rearrangements. So I live it to you. 😊

One of the implementation option is as follows: https://github.com/alv2017/pytest-flask-sqlalchemy-example/tree/fixing-import-issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant