Pytest and pytest-cov raises ImportError while importing test module

Viewed 17

After executing my test suite using Pytest + Pytest-cov I'm getting the following error:

ERROR collecting env/Lib/site-packages/social_core/tests/backends/test_yahoo.py ____________________________________ImportError while importing test module '/app/env/Lib/site-packages/social_core/tests/backends/test_yahoo.py'.

I have excluded the env folder by configuring my setup.cfg like this:

[flake8]
max-line-length = 119
exclude = .git,*/migrations/*,*env*,*venv*,__pycache__,*/staticfiles/*,*/mediafiles/*

[coverage:run]
source = .
omit=
    *apps.py,
    *settings.py,
    *urls.py,
    *wsgi.py,
    *asgi.py,
    manage.py,
    conftest.py,
    *base.py,
    *development.py,
    *production.py,
    *__init__.py,
    */migrations/*,
    *tests/*,
    */env/*,
    */venv/*,  
[coverage:report]
show_missing = True

However for some reason the test is not excluding the env folder. I can't understand why it is not excluded during test. I am running the test from docker file by executing the following command:

docker compose exec api pytest -p no:warnings --cov=.

can some one help me in figuring out the issue?

0 Answers
Related