{
  "id": "python/pytest-exit-code-no-tests-collected",
  "signature": "no tests ran in 0.00s\nERROR: file or directory not found: tests/",
  "signature_zh": "0.00s 内没有运行任何测试\nERROR: 找不到文件或目录：tests/",
  "regex": "no\\ tests\\ ran\\ in\\ 0\\.00s\\\nERROR:\\ file\\ or\\ directory\\ not\\ found:\\ tests/",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "The path passed to pytest does not exist relative to the current working directory. Often happens in CI when the working directory is the repo root but tests live in a sub-package, or when a Makefile changes directory.",
  "root_cause_type": "generic",
  "root_cause_zh": "传给 pytest 的路径相对于当前工作目录不存在。常发生在 CI 中：工作目录是仓库根，但测试位于子包中，或者 Makefile 切换了目录。",
  "versions": [
    {
      "version": "7.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "8.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "May collect unrelated tests or fail to find anything if rootdir is misconfigured.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Silences the error but runs zero tests, causing CI to pass green with no coverage.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Verify the path and use the full path:\n\npytest ./backend/tests",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Set testpaths in config so pytest finds the right directory regardless of cwd:\n\n# pyproject.toml\n[tool.pytest.ini_options]\ntestpaths = [\"backend/tests\"]",
      "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.9,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-12-02",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}