python install_error ai_generated true

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

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

Also available as: JSON · Markdown · 中文
80%Fix Rate
88%Confidence
0Evidence
2024-10-18First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
4.x active — — —

Root Cause

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

generic

中文

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

Workarounds

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

Dead Ends

Common approaches that don't work:

  1. 80% fail

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

  2. 70% fail

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