{
  "id": "python/pytest-capsys-stderr-not-captured",
  "signature": "AssertionError: assert '' in 'Some stderr output'",
  "signature_zh": "断言错误：断言 '' 在 'Some stderr output' 中",
  "regex": "AssertionError:\\ assert\\ ''\\ in\\ 'Some\\ stderr\\ output'",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "The capsys fixture captures stdout but not stderr by default, or the test is using print to stderr incorrectly.",
  "root_cause_type": "generic",
  "root_cause_zh": "capsys fixture 默认捕获 stdout 但不捕获 stderr，或者测试错误地使用了 print 到 stderr。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "capfd captures file descriptors, which may not be what you want.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This doesn't affect capture.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "captured = capsys.readouterr()\nassert 'expected' in captured.err",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "def test_foo(capfd):\n    print('stderr', file=sys.stderr)\n    captured = capfd.readouterr()\n    assert 'stderr' in captured.err",
      "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.84,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2025-10-10",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}