{
  "id": "python/pytest-timeout-fixture-hang",
  "signature": "Failed: Timeout (>30.0s) from pytest-timeout.\nE   Failed: Timeout (>30.0s) from pytest-timeout.",
  "signature_zh": "Failed: 来自 pytest-timeout 的超时（>30.0s）。\nE   Failed: 来自 pytest-timeout 的超时（>30.0s）。",
  "regex": "Failed:\\ Timeout\\ \\(>30\\.0s\\)\\ from\\ pytest\\-timeout\\.\\\nE\\ \\ \\ Failed:\\ Timeout\\ \\(>30\\.0s\\)\\ from\\ pytest\\-timeout\\.",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A fixture opens a resource (socket, subprocess, lock) and blocks indefinitely; pytest-timeout aborts the test but the fixture teardown never runs.",
  "root_cause_type": "generic",
  "root_cause_zh": "fixture 打开资源（socket、子进程、锁）并无限阻塞；pytest-timeout 中止测试但 fixture 的 teardown 从未运行。",
  "versions": [
    {
      "version": "2.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The hang is real, not slow; increasing the timeout only delays the failure and wastes CI time.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Removes the safety net; CI hangs forever.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "import socket\n\n@pytest.fixture\ndef server():\n    s = socket.socket()\n    s.settimeout(5)\n    try:\n        s.connect(('localhost', 8080))\n    except socket.timeout:\n        pytest.skip('server not reachable')\n    yield s\n    s.close()",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "pytest --timeout=30 --timeout-method=thread --timeout-func-only -q\n# Or set in pytest.ini:\n# [pytest]\n# timeout = 30\n# timeout_method = thread",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.84,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-11-19",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}