python
install_error
ai_generated
true
ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...] pytest: error: 无法识别的参数: --cov=app --cov-report=term-missing
ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...] pytest: error: unrecognized arguments: --cov=app --cov-report=term-missing
ID: python/pytest-cov-not-found
80%修复率
90%置信度
0证据数
2024-01-30首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 7.x | active | — | — | — |
| 8.x | active | — | — | — |
根因分析
未安装 pytest-cov,因此 --cov 参数不被识别。常见于 CI 环境未安装开发依赖。
English
pytest-cov is not installed, so the --cov flags are unknown. Often happens in CI where the dev requirements were not installed.
解决方案
-
97% 成功率
pip install pytest-cov # or pip install -e '.[test]' pytest --cov=app --cov-report=term-missing
-
90% 成功率
pip install coverage coverage run -m pytest coverage report -m
无效尝试
常见但无效的做法:
-
90% 失败
Still errors because the plugin is missing; the config is loaded before flag parsing.
-
85% 失败
The flag itself is provided by pytest-cov; without the plugin it is also unrecognized.