{
  "id": "python/pytest-capture-no-output",
  "signature": "AttributeError: 'CaptureFixture' object has no attribute 'readouterr'",
  "signature_zh": "AttributeError: 'CaptureFixture' 对象没有属性 'readouterr'",
  "regex": "AttributeError:\\ 'CaptureFixture'\\ object\\ has\\ no\\ attribute\\ 'readouterr'",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "In newer pytest versions, `capsys` returns a `CaptureFixture` object and the method to read output is `readouterr()`. In some versions a typo like `read_outerr` or using `capfd` incorrectly causes this.",
  "root_cause_type": "generic",
  "root_cause_zh": "在新版 pytest 中，`capsys` 返回 `CaptureFixture` 对象，读取输出的方法为 `readouterr()`。拼写错误（如 `read_outerr`）或误用 `capfd` 会导致此错误。",
  "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": "These methods don't exist on CaptureFixture.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Same API surface; typo persists.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.97,
      "how": "Use the correct method:\ndef test_out(capsys):\n    print('hi')\n    captured = capsys.readouterr()\n    assert captured.out == 'hi\\n'",
      "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-11-09",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}