{
  "id": "python/unittest-tests-not-discovered",
  "signature": "Ran 0 tests in 0.000s\n\nOK",
  "signature_zh": "在 0.000 秒内运行了 0 个测试\n\nOK",
  "regex": "Ran\\ 0\\ tests\\ in\\ 0\\.000s\\\n\\\nOK",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "unittest discovery found no tests because the module/class/method naming didn't match the pattern (test*.py, TestCase subclass, test_* method), or the start directory was wrong.",
  "root_cause_type": "generic",
  "root_cause_zh": "unittest 发现没有找到测试，因为模块/类/方法命名不匹配模式（test*.py、TestCase 子类、test_* 方法），或者起始目录错误。",
  "versions": [
    {
      "version": "3.10",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.11",
      "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": "Verbosity shows the same 'Ran 0 tests'; it doesn't fix discovery.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Different discovery rules; may still collect zero if names are wrong.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Only affects direct execution, not discovery.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "# tests/test_calc.py\nimport unittest\n\nclass TestCalc(unittest.TestCase):\n    def test_add(self):\n        self.assertEqual(1+1, 2)\n\n# run\npython -m unittest discover -s tests -p 'test*.py' -v",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "python -m unittest discover -s . -t . -p '*_test.py' -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.9,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-01-05",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}