# 未找到夹具 'benchmark'

- **ID:** `python/pytest-benchmark-no-fixture`
- **领域:** python
- **类别:** install_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

pytest-benchmark 插件未安装或未加载，因此 benchmark 夹具不可用。如果插件在 pytest.ini 中被禁用，也可能发生这种情况。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 4.x | active | — | — |

## 解决方案

1. **** (95% 成功率)
   ```
   pip install pytest-benchmark
pytest --benchmark-only
   ```
2. **** (90% 成功率)
   ```
   # pytest.ini
[pytest]
# Remove -p no:benchmark if present
addopts = -p benchmark
   ```

## 无效尝试

- **** — This shadows the plugin's fixture and does not provide benchmarking functionality. The test will not actually benchmark anything. (90% 失败率)
- **** — This provides raw timing but lacks statistical analysis, warmup, and comparison features of pytest-benchmark. (75% 失败率)
