{
  "id": "python/unittest-discovery-no-tests-ran",
  "signature": "Ran 0 tests in 0.000s",
  "signature_zh": "Ran 0 tests in 0.000s（未运行任何测试）",
  "regex": "Ran\\ 0\\ tests\\ in\\ 0\\.000s",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "unittest discover found no test modules because the pattern didn't match, the start directory wasn't a package (missing __init__.py in older versions), or filenames don't match test*.py.",
  "root_cause_type": "generic",
  "root_cause_zh": "unittest discover 未找到测试模块：匹配模式不符、起始目录不是包（旧版本缺少 __init__.py），或文件名不符合 test*.py。",
  "versions": [
    {
      "version": "3.10",
      "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": "The methods are never executed because discovery fails before collection; prints never run.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Default pattern is 'test*.py' (prefix). 'mytest.py' won't match; only 'test_*.py' or 'test*.py' work.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.92,
      "how": "python -m unittest discover -s tests -p 'test_*.py' -v\n# Ensure tests/ has __init__.py if using package-relative imports",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.88,
      "how": "git mv tests/foo_tests.py tests/test_foo.py\npython -m unittest discover -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.86,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-02-27",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}