python install_error ai_generated true

pytest.PytestConfigWarning: Unknown config option: timeout E Failed: Timeout >300.0s

ID: python/pytest-timeout-plugin-error

Also available as: JSON · Markdown · 中文
80%Fix Rate
84%Confidence
0Evidence
2024-12-02First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
2.x active — — —

Root Cause

`timeout` in pytest config requires the `pytest-timeout` plugin. Without it, the option is ignored, or with it, the test genuinely exceeded the limit.

generic

中文

pytest 配置中的 `timeout` 需要 `pytest-timeout` 插件。未安装时该选项被忽略;已安装时测试确实超时。

Workarounds

  1. 92% success
    pip install pytest-timeout, then configure:
    [tool.pytest.ini_options]
    timeout = 60
    timeout_method = "thread"
  2. 85% success
    Investigate the slow test with `pytest --durations=10` to identify the bottleneck before raising the limit.

Dead Ends

Common approaches that don't work:

  1. 60% fail

    Long-running tests can hang CI indefinitely.

  2. 70% fail

    Disables the timeout entirely, defeating the purpose.