When running pytest with the --cov option, the report contains "missing" entries for a few files with line number 0 reported as the culprit. Not all files exhibit this issue and there is no obvious correlation between the files that do.
We are running tests using tox. See various configuration items below which might help with debugging the issue.
A file which is reported as having a "missing" entry on line 0.
from knox.views import LoginView as KnoxLoginView
from rest_framework.authentication import BasicAuthentication
class LoginView(KnoxLoginView):
authentication_classes = [BasicAuthentication]
Extract from the coverage report (XML) for this file:
[tox]
env_list =
flake8
black
py311
requires =
tox>4
virtualenv>20.2
[gh-actions]
python =
3.11: flake8,black,py311
[testenv:flake8]
description = install flake8 in a virtual environment and invoke it from the root of the project
deps = flake8
commands = flake8 .
[testenv:black]
description = install black in a virtual environment and invoke it from the root of the project
deps = black
commands = black --diff --check .
[testenv]
description = install pytest in a virtual environment and invoke it from the root of the project, outputting junit and coverage reports to a reports folder.
deps =
-r requirements-test.txt
commands = pytest --junitxml=reports/unit-test-{envname}.xml --cov=. --cov-report=xml:reports/pytest-cov-{envname}.xml --cov-fail-under=95 -vvv {posargs}
When running
pytest
with the--cov
option, the report contains "missing" entries for a few files with line number0
reported as the culprit. Not all files exhibit this issue and there is no obvious correlation between the files that do.We are running tests using
tox
. See various configuration items below which might help with debugging the issue.A file which is reported as having a "missing" entry on line
0
.Extract from the coverage report (XML) for this file:
Contents of
tox.ini
:Contents of
.coveragerc
:Contents of pytest.ini:
Contents of
requirements-test.txt
: