{
  "id": "python/unittest-setupclass-not-called",
  "signature": "AssertionError: setUpClass not called before test methods",
  "signature_zh": "断言错误：在测试方法之前未调用 setUpClass",
  "regex": "AssertionError:\\ setUpClass\\ not\\ called\\ before\\ test\\ methods",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "The test class does not inherit from unittest.TestCase, or setUpClass is defined incorrectly (e.g., as an instance method).",
  "root_cause_type": "generic",
  "root_cause_zh": "测试类未继承 unittest.TestCase，或者 setUpClass 定义错误（例如，作为实例方法）。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "setUp is called for each test, not once for the class.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "If the class doesn't inherit from TestCase, it won't be recognized.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.99,
      "how": "class TestMyClass(unittest.TestCase):\n    @classmethod\n    def setUpClass(cls):\n        ...",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "@pytest.fixture(scope='class')\ndef setup():\n    ...",
      "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.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-08-30",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}