python install_error ai_generated true

fixture 'benchmark' 未找到 可用 fixtures: cache, capfd, capsys, monkeypatch, ...

fixture 'benchmark' not found Available fixtures: cache, capfd, capsys, monkeypatch, ...

ID: python/pytest-benchmark-no-benchmark-fixture

其他格式: JSON · Markdown 中文 · English
80%修复率
88%置信度
0证据数
2024-10-18首次发现

版本兼容性

版本状态引入弃用备注
4.x active — — —

根因分析

pytest-benchmark 未安装,或安装在与运行 pytest 不同的 Python 环境中。

English

pytest-benchmark is not installed or is installed in a different Python environment than the one running pytest.

generic

解决方案

  1. 98% 成功率
    python -m pip install pytest-benchmark
    python -m pytest --benchmark-only -q
  2. 90% 成功率
    which pytest
    pytest --version
    python -m pytest --version
    python -m pip install pytest-benchmark

无效尝试

常见但无效的做法:

  1. 80% 失败

    The plugin registers the fixture via entry points; a plain import does not register it if the package is missing.

  2. 70% 失败

    Shadows the real plugin and provides no timing functionality; tests pass but measure nothing.