{
  "id": "python/pytest-mark-skip-missing-import",
  "signature": "pytest.skip.Exception: Skipped: no module named 'requests'",
  "signature_zh": "pytest.skip.Exception: 跳过：没有名为 'requests' 的模块",
  "regex": "pytest\\.skip\\.Exception:\\ Skipped:\\ no\\ module\\ named\\ 'requests'",
  "domain": "python",
  "category": "module_error",
  "subcategory": null,
  "root_cause": "在测试中调用 pytest.skip() 但条件判断错误，或者 @pytest.mark.skipif 条件未正确评估。",
  "root_cause_type": "generic",
  "root_cause_zh": "在测试中调用 pytest.skip() 但条件判断错误，或者 @pytest.mark.skipif 条件未正确评估。",
  "versions": [
    {
      "version": "3.8",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "在模块顶层 try/except",
      "why_fails": "尝试在导入时使用 try/except 并跳过，但 pytest 收集阶段可能报错",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "条件逻辑错误",
      "why_fails": "尝试使用 sys.modules 检查但条件写反",
      "fail_rate": 0.4,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "使用 importorskip",
      "success_rate": 0.98,
      "how": "import pytest\nrequests = pytest.importorskip('requests')",
      "condition": "",
      "sources": []
    },
    {
      "action": "使用 skipif 装饰器",
      "success_rate": 0.9,
      "how": "@pytest.mark.skipif(not ORG, reason='no requests')\ndef test():\n    import requests",
      "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.92,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2025-01-15",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}