{
  "id": "python/pytest-fixture-return-not-yield",
  "signature": "Fixture 'db' called directly. Fixtures are not meant to be called directly",
  "signature_zh": "fixture 'db'被直接调用。fixture不应被直接调用",
  "regex": "Fixture\\ 'db'\\ called\\ directly\\.\\ Fixtures\\ are\\ not\\ meant\\ to\\ be\\ called\\ directly",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "在测试中直接调用fixture函数，而不是作为参数注入，导致pytest报错。",
  "root_cause_type": "generic",
  "root_cause_zh": "测试中直接调用了fixture函数，而非通过参数注入。",
  "versions": [
    {
      "version": "3.7",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "失去fixture的依赖注入和清理功能。",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "直接调用返回的是fixture对象，不是预期值。",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 1.0,
      "how": "def test_example(db):\n    assert db is not None",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "def test_example(request):\n    db = request.getfixturevalue('db')",
      "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.88,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2025-06-30",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}