{
  "id": "python/pytest-tmpdir-factory-error",
  "signature": "AttributeError: 'TempPathFactory' object has no attribute 'mktemp'",
  "signature_zh": "属性错误：'TempPathFactory' 对象没有属性 'mktemp'",
  "regex": "AttributeError:\\ 'TempPathFactory'\\ object\\ has\\ no\\ attribute\\ 'mktemp'",
  "domain": "python",
  "category": "attribute_error",
  "subcategory": null,
  "root_cause": "在非 pytest 环境中使用了 tmp_path_factory，或版本不支持该方法。",
  "root_cause_type": "generic",
  "root_cause_zh": "在非 pytest 环境中使用了 tmp_path_factory，或版本不支持该方法。",
  "versions": [
    {
      "version": "7.4.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "绕过 pytest 的临时目录管理，可能冲突。",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "如果已是最新版本，无济于事。",
      "fail_rate": 0.4,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 1.0,
      "how": "在测试函数中直接使用 `tmp_path` 参数，pytest 自动提供。",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "确保 pytest >= 7.0 并使用 `tmp_path_factory.mktemp('name')`。",
      "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.83,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2025-06-15",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}