I have faced this issue when I am trying to test in a Django project from docker. Based on the instructions in the tutorial, I have implemented successfully black test and isort test successfully. However, when it comes t0 Pytest I am facing the aforementioned issue despite the fact that I have specified the exclusion of env files in my setup.cfg file using omit command of pytest-cov tool. Here are is my setup for setup.cfg file:
[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/*,
*/venv/*,
[coverage:report]
show_missing = True
The only variation between the youtube tutorial and my setup is that the Tutor create his virtual env using venv however I used env name. I have tested this but to no avail.
Furthermore, pytest.ini file was set up like this:
[pytest]
DJANGO_SETTINGS_MODULE = real_estate.settings.development
python_files = tests.py test_*.py *_tests.py
Also, project.toml is set up like this:
[tool.black]
extend-exclude = '''
/(
| env
)/
'''
However when I run the test using the command:
docker compose exec api pytest -p no:warnings --cov=.
I am facing the following errors:
ERROR collecting env/Lib/site-packages/social_core/tests/backends/test_twitch.py _
ERROR env/Lib/site-packages/social_core/tests/backends/test_lyft.py
ERROR env/Lib/site-packages/social_core/tests/backends/test_mailru.py
ERROR env/Lib/site-packages/social_core/tests/backends/test_mapmyfitness.py
ERROR env/Lib/site-packages/social_core/tests/backends/test_microsoft.py
Interrupted: 127 errors during collection 127 errors in 96.11s (0:01:36)