{
  "id": "python/unittest-setupclass-order-error",
  "signature": "RuntimeError: setUpClass is not called for TestCase subclass because it has no __test__ attribute",
  "signature_zh": "运行时错误：因为 TestCase 子类没有 __test__ 属性，setUpClass 未被调用",
  "regex": "RuntimeError:\\ setUpClass\\ is\\ not\\ called\\ for\\ TestCase\\ subclass\\ because\\ it\\ has\\ no\\ __test__\\ attribute",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "当测试类名以 'test' 开头但缺少 __test__ 属性时，unittest 将其视为非测试类",
  "root_cause_type": "generic",
  "root_cause_zh": "当测试类名以 'test' 开头但缺少 __test__ 属性时，unittest 将其视为非测试类",
  "versions": [
    {
      "version": "3.12",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "unittest 框架仍会因其他原因跳过该类",
      "fail_rate": 0.4,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "如果类没有正确继承 TestCase，仍会失败",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "确保类继承自 unittest.TestCase，并命名以 test 开头",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.7,
      "how": "自定义 loader 加载测试类，指定 loadTestsFromTestCase",
      "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.8,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-02-10",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}