{
  "id": "python/pytest-fail-outcomes-failed",
  "signature": "pytest.fail(_pytest.outcomes.Failed): test failed intentionally",
  "signature_zh": "pytest.fail(_pytest.outcomes.Failed)：测试有意失败",
  "regex": "pytest\\.fail\\(_pytest\\.outcomes\\.Failed\\):\\ test\\ failed\\ intentionally",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "pytest.fail() was called explicitly to mark a test as failed, often due to a custom condition.",
  "root_cause_type": "generic",
  "root_cause_zh": "显式调用 pytest.fail() 将测试标记为失败，通常由于自定义条件。",
  "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"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Removing pytest.fail() call without fixing logic",
      "why_fails": "The underlying condition that triggered the fail remains unaddressed.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "Replacing with assert False",
      "why_fails": "assert False does not provide a custom message and may be less informative.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Use pytest.fail with a descriptive message",
      "success_rate": 0.9,
      "how": "pytest.fail('Custom failure: expected condition not met')",
      "condition": "",
      "sources": []
    },
    {
      "action": "Raise a custom exception with pytest.fail",
      "success_rate": 0.85,
      "how": "if not condition: pytest.fail('Condition failed: ' + str(condition))",
      "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.88,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-02-20",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}