python install_error ai_generated true

fixture 'benchmark' not found

ID: python/pytest-benchmark-no-plugin

Also available as: JSON · Markdown · 中文
80%Fix Rate
90%Confidence
0Evidence
2024-03-05First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
4.x active — — —

Root Cause

The `pytest-benchmark` plugin is not installed or not enabled, so the `benchmark` fixture is unavailable.

generic

中文

`pytest-benchmark` 插件未安装或未启用,因此 `benchmark` fixture 不可用。

Workarounds

  1. 95% success
    pip install pytest-benchmark
    pytest --benchmark-only
  2. 90% success
    echo 'pytest-benchmark' >> requirements-dev.txt
    pip install -r requirements-dev.txt

Dead Ends

Common approaches that don't work:

  1. 80% fail

    Loses all benchmarking features (statistics, comparison, JSON output).

  2. 90% fail

    Fails if the plugin is not installed; the error becomes `ModuleNotFoundError`.