{
  "id": "python/pytest-deprecation-yield-fixture",
  "signature": "DeprecationWarning: @pytest.yield_fixture is deprecated. Use @pytest.fixture instead; they are the same.",
  "signature_zh": "DeprecationWarning: @pytest.yield_fixture 已弃用。请改用 @pytest.fixture；两者相同。",
  "regex": "DeprecationWarning:\\ @pytest\\.yield_fixture\\ is\\ deprecated\\.\\ Use\\ @pytest\\.fixture\\ instead;\\ they\\ are\\ the\\ same\\.",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "Since pytest 3.0, yield_fixture is an alias of fixture. In pytest 7+ the alias emits a DeprecationWarning and will be removed.",
  "root_cause_type": "generic",
  "root_cause_zh": "自 pytest 3.0 起，yield_fixture 是 fixture 的别名。在 pytest 7+ 中该别名会发出 DeprecationWarning，并将在未来移除。",
  "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": "Hides the warning but leaves the deprecated API in place; the fixture will break on the next major release.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Blocks upgrades and security patches across the whole test toolchain.",
      "fail_rate": 0.65,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.98,
      "how": "# before\n@pytest.yield_fixture\ndef client(): ...\n\n# after\n@pytest.fixture\ndef client(): ...",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "pyupgrade --py38-plus tests/**/*.py",
      "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.9,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-04-02",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}