{
  "id": "python/pytest-fail-without-message",
  "signature": "pytest.fail() called without a message; use pytest.fail(reason='...')",
  "signature_zh": "pytest.fail() 被调用但未提供消息；请使用 pytest.fail(reason='...')",
  "regex": "pytest\\.fail\\(\\)\\ called\\ without\\ a\\ message;\\ use\\ pytest\\.fail\\(reason='\\.\\.\\.'\\)",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Calling pytest.fail() without a reason argument is deprecated or raises an error in newer pytest versions to enforce descriptive failure messages.",
  "root_cause_type": "generic",
  "root_cause_zh": "在较新的 pytest 版本中，调用 pytest.fail() 而不提供 reason 参数已被弃用或引发错误，以强制提供描述性的失败消息。",
  "versions": [
    {
      "version": "3.10",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Using a bare raise or assert False may work but loses the structured failure reporting of pytest.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Ignoring the warning and continuing to use pytest.fail() without argument may cause test failures in future pytest versions.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Always provide a reason: pytest.fail(reason='Expected condition not met')",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Use pytest.fail('message') as a positional argument, which is equivalent to pytest.fail(reason='message').",
      "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.86,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2026-09-01",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}