{
  "id": "python/valueerror-no-tests-collected",
  "signature": "ValueError: No tests were collected. Ensure test files start with 'test_' or end with '_test.py'.",
  "signature_zh": "值错误：未收集到任何测试。确保测试文件以 'test_' 开头或以 '_test.py' 结尾。",
  "regex": "ValueError:\\ No\\ tests\\ were\\ collected\\.\\ Ensure\\ test\\ files\\ start\\ with\\ 'test_'\\ or\\ end\\ with\\ '_test\\.py'\\.",
  "domain": "python",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "Pytest or unittest cannot find test files because they do not follow the default naming conventions.",
  "root_cause_type": "generic",
  "root_cause_zh": "Pytest 或 unittest 找不到测试文件，因为它们不符合默认命名约定。",
  "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"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Creating test files with arbitrary names",
      "why_fails": "Pytest only discovers files matching patterns like test_*.py or *_test.py.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "Running pytest from wrong directory",
      "why_fails": "If tests are in a subdirectory, pytest must be run from the root or with --rootdir.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Rename test files to match pattern",
      "success_rate": 0.95,
      "how": "mv my_tests.py test_my_tests.py",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use pytest --collect-only to debug discovery",
      "success_rate": 0.9,
      "how": "pytest --collect-only -v",
      "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.84,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-05-12",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}