{
  "id": "python/pytest-skipif-condition-evaluation-error",
  "signature": "Skipped: evaluating condition 'sys.platform == \"win32\"' raised AttributeError: module 'sys' has no attribute 'platform'",
  "signature_zh": "Skipped: 评估条件 'sys.platform == \"win32\"' 引发 AttributeError: 模块 'sys' 没有属性 'platform'",
  "regex": "Skipped:\\ evaluating\\ condition\\ 'sys\\.platform\\ ==\\ \"win32\"'\\ raised\\ AttributeError:\\ module\\ 'sys'\\ has\\ no\\ attribute\\ 'platform'",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "The condition in @pytest.mark.skipif references a non-existent attribute, often due to a typo (e.g., 'platfom' instead of 'platform').",
  "root_cause_type": "generic",
  "root_cause_zh": "@pytest.mark.skipif 中的条件引用了一个不存在的属性，通常是由于拼写错误（例如 'platfom' 而不是 'platform'）。",
  "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 may cause the test to run on unsupported platforms and fail.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The condition string is evaluated at module level; try-except is not supported in that context.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Correct the attribute name: `@pytest.mark.skipif(sys.platform == 'win32', reason='not on Windows')`",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Use a function for complex conditions: `def is_win(): return sys.platform == 'win32'; @pytest.mark.skipif(is_win())`",
      "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": "2025-06-20",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}