python
install_error
ai_generated
true
未找到夹具 'benchmark'
fixture 'benchmark' not found
ID: python/pytest-benchmark-no-fixture
80%修复率
87%置信度
0证据数
2024-06-07首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 4.x | active | — | — | — |
根因分析
pytest-benchmark 插件未安装或未加载,因此 benchmark 夹具不可用。如果插件在 pytest.ini 中被禁用,也可能发生这种情况。
English
pytest-benchmark plugin is not installed or not loaded, so the benchmark fixture is unavailable. This can also happen if the plugin is disabled in pytest.ini.
解决方案
-
95% 成功率
pip install pytest-benchmark pytest --benchmark-only
-
90% 成功率
# pytest.ini [pytest] # Remove -p no:benchmark if present addopts = -p benchmark
无效尝试
常见但无效的做法:
-
90% 失败
This shadows the plugin's fixture and does not provide benchmarking functionality. The test will not actually benchmark anything.
-
75% 失败
This provides raw timing but lacks statistical analysis, warmup, and comparison features of pytest-benchmark.