{
  "id": "python/pytest-capsys-output-not-captured",
  "signature": "AssertionError: assert 'hello' in ''",
  "signature_zh": "断言错误：断言'hello'在''中",
  "regex": "AssertionError:\\ assert\\ 'hello'\\ in\\ ''",
  "domain": "python",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "capsys fixture未正确捕获stdout，通常因为输出被缓冲或使用了错误的捕获模式。",
  "root_cause_type": "generic",
  "root_cause_zh": "capsys未捕获输出，可能因为缓冲区或捕获模式问题。",
  "versions": [
    {
      "version": "3.6",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "print输出可能被capsys捕获，但断言失败说明捕获内容为空。",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "与print类似，可能仍被捕获。",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "def test_output(capsys):\n    print('hello')\n    captured = capsys.readouterr()\n    assert 'hello' in captured.out",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "def test_output(capfd):\n    print('hello')\n    captured = capfd.readouterr()\n    assert 'hello' in captured.out",
      "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.81,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2025-03-05",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}