-
Notifications
You must be signed in to change notification settings - Fork 224
Description
Summary
Original issue has been opened at coveragepy: nedbat/coveragepy#1355.
I get CoverageWarning: --include is ignored because --source is set (include-ignored) self.warn("--include is ignored because --source is set", slug="include-ignored") although only include is specified in .coveragerc and nowhere --source is specified.
As @nedbat correctly commented, it seems that pytest-cov seems to automatically set the --source option. Removal of pytest-cov resolved the problem.
Expected vs actual result
Expected: No CoverageWarning: --include is ignored because --source is set (include-ignored) self.warn("--include is ignored because --source is set", slug="include-ignored") and not setting --source when source is nowhere specified.
Reproducer
Minimal example is here: https://github.com/gro1m/coverageminimalexample
NOTE: I substituted my HOME PATH with ~ on line 6 in the generated coverage.xml, this is an alteration I did after the program has been run.
Commands run: pytest
Versions
Python: 3.9.7, 3.10.4 respectively
coveragepy: 6.3.2
pytest: 7.1.1
pytest-cov: 3.0.0
Config
.coveragerc
[run]
include =
pycobertura/*
pytest.ini: https://github.com/aconrad/pycobertura/blob/master/pytest.ini
setup.cfg: https://github.com/aconrad/pycobertura/blob/master/setup.cfg
Code
- Minimal example: https://github.com/gro1m/coverageminimalexample
- Actual use case: https://github.com/aconrad/pycobertura/tree/e8150644ee644ec95519d1dc8c99878e67a38e68 (the current master branch contains a workaround based on the following PR that does not use pytest-cov anymore: make sure that coverage.xml includes file path prefix aconrad/pycobertura#140)