{
  "id": "python/pytest-exit-code-5-no-tests-collected",
  "signature": "no tests ran in 0.12s\nERROR: file or directory not found: tests/test_api.py",
  "signature_zh": "no tests ran in 0.12s\nERROR: 文件或目录未找到: tests/test_api.py",
  "regex": "no\\ tests\\ ran\\ in\\ 0\\.12s\\\nERROR:\\ file\\ or\\ directory\\ not\\ found:\\ tests/test_api\\.py",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "The path passed to pytest does not exist relative to the current working directory, or the test file was renamed/moved. pytest exits with code 5 (EXIT_NOTESTSCOLLECTED) when no tests are collected.",
  "root_cause_type": "generic",
  "root_cause_zh": "传给 pytest 的路径相对于当前工作目录不存在，或测试文件被重命名/移动。当未收集到测试时，pytest 以代码 5（EXIT_NOTESTSCOLLECTED）退出。",
  "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": "Ignoring the directory means the intended tests never run; the CI job passes green while testing nothing.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Masks genuinely missing tests and broken collection, allowing regressions through.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.92,
      "how": "cd /app && pytest",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.88,
      "how": "test -f tests/test_api.py && pytest tests/test_api.py || echo 'missing test file'",
      "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-04-22",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}