python install_error ai_generated true

pytest.PytestConfigWarning: 未知配置项: timeout E Failed: 超时 >300.0s

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

ID: python/pytest-timeout-plugin-error

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

版本兼容性

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

根因分析

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

English

`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

解决方案

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

无效尝试

常见但无效的做法:

  1. 60% 失败

    Long-running tests can hang CI indefinitely.

  2. 70% 失败

    Disables the timeout entirely, defeating the purpose.