Skip to content

ImportError when running tests #2

Open
@alv2017

Description

@alv2017

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions