{
  "id": "python/pytest-failed-fixture-setup",
  "signature": "Failed: fixture 'db' setup failed",
  "signature_zh": "失败：fixture 'db'设置失败",
  "regex": "Failed:\\ fixture\\ 'db'\\ setup\\ failed",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "fixture在设置阶段抛出异常，导致测试无法执行。",
  "root_cause_type": "generic",
  "root_cause_zh": "fixture初始化时出错，导致测试失败。",
  "versions": [
    {
      "version": "3.8",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "测试无法运行，忽略没有意义。",
      "fail_rate": 1.0,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "根本原因是异常，不是返回值。",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.8,
      "how": "@pytest.fixture\ndef db():\n    try:\n        return setup_db()\n    except Exception as e:\n        pytest.skip(f'Database unavailable: {e}')",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "@pytest.fixture\ndef db():\n    db = setup_db()\n    yield db\n    db.close()",
      "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.82,
  "fix_success_rate": 0.8,
  "resolvable": "partial",
  "first_seen": "2024-12-01",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}