{
  "id": "python/pytest-warnings-summary-failed",
  "signature": "Failed: Warnings summary\n...\nPytestUnraisableExceptionWarning: Exception ignored in: <function ...>",
  "signature_zh": "Failed: 警告摘要\n...\nPytestUnraisableExceptionWarning: 异常被忽略: <function ...>",
  "regex": "Failed:\\ Warnings\\ summary\\\n\\.\\.\\.\\\nPytestUnraisableExceptionWarning:\\ Exception\\ ignored\\ in:\\ <function\\ \\.\\.\\.>",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "An unraisable exception occurred during garbage collection, often due to a file or socket not being closed properly. pytest treats this as a failure when -W error is set or when the warning is configured as error.",
  "root_cause_type": "generic",
  "root_cause_zh": "在垃圾回收期间发生了无法引发的异常，通常是由于文件或套接字未正确关闭。当设置了 -W error 或警告被配置为错误时，pytest 会将其视为失败。",
  "versions": [
    {
      "version": "7.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "8.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "This hides the symptom but the resource leak remains, potentially causing other issues.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Forcing collection may trigger the warning earlier but does not fix the leak.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Use context managers or explicit close in teardown:\n@pytest.fixture\ndef resource():\n    r = open('file')\n    yield r\n    r.close()",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.8,
      "how": "In pytest.ini:\n[pytest]\nfilterwarnings =\n    ignore::pytest.PytestUnraisableExceptionWarning",
      "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.85,
  "fix_success_rate": 0.8,
  "resolvable": "partial",
  "first_seen": "2024-04-05",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}