Open
Description
Summary
If pytest
runs in e.g. ./tests/
, it reads ../pyproject.toml
for configuration options, and that squares with my expectation. pytest-cov
does seem to look only for ./pyproject.toml
(and also writes ./.coverage
instead of keeping that file at the project root), and that causes it to run with different settings depending on where pytest
is invoked.
Case in point, I have this in my config:
[tool.coverage.report]
exclude_also = [
'def __repr__',
]
If I run pytest
from the project root directory, I get 100% coverage. If I run it from the tests/
subdirectory, all __repr__
functions, which I don't test, get reports as uncovered.
Reproducer
Versions
pytest 8.3.5
pytest-cov 6.1.1
coverage 7.8.0
Python 3.13.3
Metadata
Metadata
Assignees
Labels
No labels