{
  "id": "python/unittest-no-tests-ran",
  "signature": "Ran 0 tests in 0.000s\n\nNO TESTS RAN\n\nFAILED (errors=0)",
  "signature_zh": "Ran 0 tests in 0.000s\n\nNO TESTS RAN\n\nFAILED (errors=0)",
  "regex": "Ran\\ 0\\ tests\\ in\\ 0\\.000s\\\n\\\nNO\\ TESTS\\ RAN\\\n\\\nFAILED\\ \\(errors=0\\)",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "unittest discovery found no test methods because the class does not subclass unittest.TestCase, method names do not start with `test`, or the module is not named `test*.py` / the start directory is wrong.",
  "root_cause_type": "generic",
  "root_cause_zh": "unittest 发现机制没有找到任何测试方法，因为类没有继承 unittest.TestCase、方法名不以 `test` 开头，或模块没有命名为 `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": "Default discovery pattern is `test*.py`; `tests.py` does not match, so still 0 tests.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Running via `python -m unittest discover` ignores that block; discovery still finds nothing.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Ensure the class inherits TestCase and methods start with test:\nimport unittest\nclass TestMath(unittest.TestCase):\n    def test_add(self):\n        self.assertEqual(1+1, 2)",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Point discovery at the right start dir and pattern:\npython -m unittest discover -s tests -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.86,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-02-20",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}