{
  "id": "python/pytest-fail-exception",
  "signature": "Failed: FAILED test_function - AssertionError: custom message",
  "signature_zh": "失败：FAILED test_function - 断言错误：自定义消息",
  "regex": "Failed:\\ FAILED\\ test_function\\ \\-\\ AssertionError:\\ custom\\ message",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "使用pytest.fail()或断言失败时，pytest抛出Failed异常，测试停止。",
  "root_cause_type": "generic",
  "root_cause_zh": "使用pytest.fail()或断言失败时，pytest抛出Failed异常，测试停止。",
  "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": "Failed是pytest内部异常，捕获后测试仍会失败",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "assert信息不如pytest.fail清晰",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "pytest.fail(\"原因: \" + str(detail))",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.8,
      "how": "if not condition:\n    pytest.skip('跳过原因')",
      "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": "2024-07-15",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}