{
  "id": "python/fixturenotfounderror-fixture-not-found",
  "signature": "fixture 'db_session' not found",
  "signature_zh": "fixture 'db_session' 未找到",
  "regex": "fixture\\ 'db_session'\\ not\\ found",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "Pytest cannot locate a fixture because it is not defined, imported, or spelled incorrectly in the test function.",
  "root_cause_type": "generic",
  "root_cause_zh": "Pytest 无法找到 fixture，因为它未定义、未导入或在测试函数中拼写错误。",
  "versions": [
    {
      "version": "3.8",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.9",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.10",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Defining fixture in the same file but with wrong name",
      "why_fails": "Fixture name must match exactly; typos cause not found errors.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "Using fixture from conftest without importing",
      "why_fails": "conftest fixtures are automatically available, but only if conftest is in the correct directory.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Define fixture in conftest.py at the appropriate level",
      "success_rate": 0.95,
      "how": "# conftest.py\n@pytest.fixture\ndef db_session():\n    return create_session()",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use @pytest.fixture decorator in test file",
      "success_rate": 0.9,
      "how": "@pytest.fixture\ndef db_session():\n    return create_session()",
      "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.86,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-07-22",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}