{
  "id": "python/pytest-datadir-missing-file",
  "signature": "FileNotFoundError: [Errno 2] No such file or directory: '/repo/tests/test_parser/input.csv'",
  "signature_zh": "FileNotFoundError: [Errno 2] 没有那个文件或目录: '/repo/tests/test_parser/input.csv'",
  "regex": "FileNotFoundError:\\ \\[Errno\\ 2\\]\\ No\\ such\\ file\\ or\\ directory:\\ '/repo/tests/test_parser/input\\.csv'",
  "domain": "python",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "pytest-datadir resolves `data/` relative to the test module's directory; the file lives in the wrong path, the plugin is not installed, or the test file was moved without moving its data directory.",
  "root_cause_type": "generic",
  "root_cause_zh": "pytest-datadir 将 `data/` 解析为相对于测试模块的目录；文件路径错误、插件未安装，或测试文件移动时未一并移动数据目录。",
  "versions": [
    {
      "version": "0.8",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Breaks on CI and other machines; path does not exist there.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Silently produces empty fixtures and the test asserts against wrong data.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Place data next to the test as `tests/test_parser/input.csv` and reference it via the `datadir` fixture:\ndef test_parse(datadir):\n    path = datadir / 'input.csv'\n    assert path.exists()",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "Or use `tmp_path` + `shutil.copy` from a committed fixtures dir:\nimport shutil\nFIXTURES = Path(__file__).parent / 'fixtures'\ndef test_parse(tmp_path):\n    src = FIXTURES / 'input.csv'\n    dst = tmp_path / 'input.csv'\n    shutil.copy(src, dst)",
      "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.8,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-06-01",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}