{
  "id": "python/pytest-capture-log-error",
  "signature": "LogCaptureError: cannot use capsys and caplog at the same time",
  "signature_zh": "日志捕获错误：不能同时使用 capsys 和 caplog",
  "regex": "LogCaptureError:\\ cannot\\ use\\ capsys\\ and\\ caplog\\ at\\ the\\ same\\ time",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "在同一个测试函数中同时请求了 capsys 和 caplog fixture，pytest 不支持",
  "root_cause_type": "generic",
  "root_cause_zh": "在同一个测试函数中同时请求了 capsys 和 caplog fixture，pytest 不支持",
  "versions": [
    {
      "version": "7.4.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "可能失去需要的功能",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "capsys 捕获 stdout，不捕获日志",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "def test_foo(caplog): ... 使用 caplog.text 检查日志",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "def test_foo(capsys): ... 使用 capsys.readouterr()",
      "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": "2024-11-02",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}