python
config_error
ai_generated
true
Coverage.py warning: No data was collected. (no-data-collected)
ID: python/pytest-cov-no-data-collected
80%Fix Rate
90%Confidence
0Evidence
2024-04-15First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 4.1 | active | — | — | — |
Root Cause
pytest-cov did not collect coverage because the source paths are not specified or the tests did not import the target modules.
generic中文
pytest-cov 未收集覆盖率,因为未指定源路径或测试未导入目标模块。
Workarounds
-
98% success
Run: pytest --cov=myapp tests/ Or in pytest.ini: [pytest] addopts = --cov=myapp
-
90% success
Check that test files import the modules under test. Coverage only measures executed code.
Dead Ends
Common approaches that don't work:
-
70% fail
Without a path, coverage may not know which files to measure.
-
90% fail
This disables coverage reporting entirely.