python
install_error
ai_generated
true
fixture 'benchmark' not found available fixtures: cache, capfd, ...
ID: python/pytest-benchmark-not-found
80%Fix Rate
88%Confidence
0Evidence
2025-02-24First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 7.x | active | — | — | — |
| 8.x | active | — | — | — |
Root Cause
pytest-benchmark is not installed, so the 'benchmark' fixture it provides is unavailable. Common when copying benchmark tests into a repo without the dev dependency.
generic中文
未安装 pytest-benchmark,因此它提供的 'benchmark' fixture 不可用。常见于将 benchmark 测试复制到未安装开发依赖的仓库。
Workarounds
-
97% success
pip install pytest-benchmark # then def test_sort(benchmark): result = benchmark(sorted, list(range(1000))) assert result[0] == 0 -
90% success
import pytest pytest.importorskip('pytest_benchmark') def test_sort(benchmark): benchmark(sorted, list(range(1000)))
Dead Ends
Common approaches that don't work:
-
90% fail
Provides no timing, statistics, or comparison; the test gives false confidence.
-
70% fail
No integration with pytest reporting, no --benchmark-compare, and noisy CI output.