{
  "id": "python/pytest-tmpdir-deprecation-error",
  "signature": "Failed: The tmpdir fixture is deprecated, use tmp_path instead\nE   pytest.PytestRemovedIn9Warning: The tmpdir fixture is deprecated",
  "signature_zh": "Failed: tmpdir fixture 已弃用，请改用 tmp_path\nE   pytest.PytestRemovedIn9Warning: tmpdir fixture 已弃用",
  "regex": "Failed:\\ The\\ tmpdir\\ fixture\\ is\\ deprecated,\\ use\\ tmp_path\\ instead\\\nE\\ \\ \\ pytest\\.PytestRemovedIn9Warning:\\ The\\ tmpdir\\ fixture\\ is\\ deprecated",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "The test uses `tmpdir` which is deprecated in pytest 8 in favor of `tmp_path`. With `filterwarnings = error`, the deprecation becomes a failure.",
  "root_cause_type": "generic",
  "root_cause_zh": "测试使用 `tmpdir`，在 pytest 8 中已被弃用，推荐使用 `tmp_path`。当 `filterwarnings = error` 时，弃用警告变为失败。",
  "versions": [
    {
      "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 the API will be removed in pytest 9, causing future breakage.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Delays the migration but blocks other fixes and security updates.",
      "fail_rate": 0.55,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Replace `tmpdir` with `tmp_path`:\ndef test_file(tmp_path):\n    p = tmp_path / 'data.txt'\n    p.write_text('hi')\n    assert p.read_text() == 'hi'",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.8,
      "how": "If you need py.path API, use `tmp_path` and `py.path.local(tmp_path)` explicitly.",
      "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.87,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-04-23",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}