{
  "id": "python/unittest-testloader-filenotfounderror",
  "signature": "FileNotFoundError: [Errno 2] No such file or directory: 'test_data.csv'",
  "signature_zh": "FileNotFoundError: [Errno 2] 没有那个文件或目录: 'test_data.csv'",
  "regex": "FileNotFoundError:\\ \\[Errno\\ 2\\]\\ No\\ such\\ file\\ or\\ directory:\\ 'test_data\\.csv'",
  "domain": "python",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "A unittest TestCase tries to load a data file using a relative path, but the current working directory is not the test data directory.",
  "root_cause_type": "generic",
  "root_cause_zh": "一个 unittest TestCase 尝试使用相对路径加载数据文件，但当前工作目录不是测试数据目录。",
  "versions": [
    {
      "version": "3.8",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.9",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.10",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.11",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.12",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "This is inefficient and clutters the project; the file might still be missed if the path resolution is inconsistent.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This can affect other tests running in parallel and cause race conditions or side effects.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Use an absolute path derived from the test file location: `import os; data_path = os.path.join(os.path.dirname(__file__), 'test_data.csv')`",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Place test data in a fixed directory and configure the test runner to always start from the project root.",
      "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.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-05-20",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}