python
install_error
ai_generated
true
pytest.PytestConfigError: Unknown plugin: 'pytest-cov'
ID: python/pytest-missing-plugin
80%Fix Rate
87%Confidence
0Evidence
2024-07-10First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.11 | active | — | — | — |
Root Cause
The pytest configuration (pytest.ini, pyproject.toml, or conftest.py) references a plugin that is not installed in the current Python environment, causing pytest to fail on startup.
generic中文
pytest 配置文件(pytest.ini、pyproject.toml 或 conftest.py)引用了当前 Python 环境中未安装的插件,导致 pytest 启动失败。
Workarounds
-
95% success
Install the missing plugin using pip: pip install pytest-cov, then re-run pytest.
-
90% success
If the plugin is not needed, remove its reference from the configuration file (e.g., delete 'pytest-cov' from addopts or plugins list).
Dead Ends
Common approaches that don't work:
-
80% fail
Adding the plugin name to conftest.py's pytest_plugins list without installing it first still raises the same error.
-
50% fail
Ignoring the error and running tests with -p no:plugin may suppress the error but disables the plugin's functionality.