{
  "id": "python/pytest-skipif-string-condition",
  "signature": "Failed: Skipped: you need to specify a reason the pytest.mark.skipif is skipping\nERROR: found no collectors for tests/test_x.py::test_y",
  "signature_zh": "Failed: Skipped: 你需要在 pytest.mark.skipif 中指定跳过的原因\nERROR: 未找到 tests/test_x.py::test_y 的收集器",
  "regex": "Failed:\\ Skipped:\\ you\\ need\\ to\\ specify\\ a\\ reason\\ the\\ pytest\\.mark\\.skipif\\ is\\ skipping\\\nERROR:\\ found\\ no\\ collectors\\ for\\ tests/test_x\\.py::test_y",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "pytest.mark.skipif requires both a condition and a reason keyword. Passing a string as the first positional arg (a common mistake) makes pytest treat it as an invalid condition.",
  "root_cause_type": "generic",
  "root_cause_zh": "pytest.mark.skipif 需要同时提供条件和 reason 关键字。将字符串作为第一个位置参数传入（常见错误）会让 pytest 视为无效条件。",
  "versions": [
    {
      "version": "7.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "8.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Unconditionally skips the test even on platforms where it should run.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Positional args are not supported for reason; must be keyword.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.98,
      "how": "Use keyword arguments:\n  @pytest.mark.skipif(sys.platform == 'win32', reason='POSIX-only')\n  def test_x(): ...",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.95,
      "how": "For module-level skips:\n  pytestmark = pytest.mark.skipif(condition, reason='...')",
      "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.9,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-03-05",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}