{
  "id": "python/pytest-tmp-path-permission",
  "signature": "PermissionError: [Errno 13] Permission denied: '/tmp/pytest-of-user/pytest-123/test_xxx0/tmp_file.txt'",
  "signature_zh": "权限错误：[Errno 13] 权限被拒绝：'/tmp/pytest-of-user/pytest-123/test_xxx0/tmp_file.txt'",
  "regex": "PermissionError:\\ \\[Errno\\ 13\\]\\ Permission\\ denied:\\ '/tmp/pytest\\-of\\-user/pytest\\-123/test_xxx0/tmp_file\\.txt'",
  "domain": "python",
  "category": "system_error",
  "subcategory": null,
  "root_cause": "测试尝试写入 tmp_path 目录，但该目录权限受限，或测试以非特权用户运行。",
  "root_cause_type": "generic",
  "root_cause_zh": "测试尝试写入 tmp_path 目录，但该目录权限受限，或测试以非特权用户运行。",
  "versions": [
    {
      "version": "7.4.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "8.0.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "修改系统目录权限可能影响其他进程，且不安全。",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "绝对路径可能指向不可写位置，且测试不可移植。",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "在测试中打印 tmp_path 并确保目录存在且可写，必要时使用 `tmp_path.mkdir(parents=True, exist_ok=True)`。",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "使用 `tmp_path_factory.mktemp('test_dir')` 创建自定义目录，确保权限正确。",
      "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.82,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-08-12",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}