{
  "id": "python/unittest-skipif-attributeerror",
  "signature": "AttributeError: module 'sys' has no attribute 'version_info'",
  "signature_zh": "AttributeError: 模块 'sys' 没有属性 'version_info'",
  "regex": "AttributeError:\\ module\\ 'sys'\\ has\\ no\\ attribute\\ 'version_info'",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A typo in the skipIf condition: `version_info` is misspelled or accessed incorrectly, causing an AttributeError during test discovery.",
  "root_cause_type": "generic",
  "root_cause_zh": "skipIf 条件中的拼写错误：`version_info` 拼写错误或访问不正确，导致在测试发现期间出现 AttributeError。",
  "versions": [
    {
      "version": "3.8",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.9",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "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": "This defeats the purpose of conditional skipping and may cause failures in unsupported environments.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Decorators cannot be wrapped in try-except in that way; it will still raise an error at import time.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Correct the attribute name: `@unittest.skipIf(sys.version_info < (3, 7), 'requires Python 3.7+')`",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Use pytest markers instead: `@pytest.mark.skipif(sys.version_info < (3,7))`",
      "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-11-15",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}