{
  "id": "python/pytest-capture-caplog-attribute-error",
  "signature": "AttributeError: 'LogCaptureFixture' object has no attribute 'records'",
  "signature_zh": "属性错误：'LogCaptureFixture' 对象没有属性 'records'",
  "regex": "AttributeError:\\ 'LogCaptureFixture'\\ object\\ has\\ no\\ attribute\\ 'records'",
  "domain": "python",
  "category": "module_error",
  "subcategory": null,
  "root_cause": "Using an outdated or incorrect API for caplog; 'records' was introduced in pytest 6.x but may not be available in older versions or when caplog is not properly initialized.",
  "root_cause_type": "generic",
  "root_cause_zh": "使用了过时或不正确的 caplog API；'records' 在 pytest 6.x 中引入，但在旧版本或 caplog 未正确初始化时可能不可用。",
  "versions": [
    {
      "version": "3.8",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.9",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Trying to access caplog.records without checking pytest version",
      "why_fails": "If pytest version is below 6.0, 'records' attribute doesn't exist.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "Using caplog.text instead of caplog.records for log level checks",
      "why_fails": "caplog.text returns a string, not log records, so level filtering fails.",
      "fail_rate": 0.65,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Upgrade pytest to version 6.0 or later to support caplog.records.",
      "success_rate": 0.95,
      "how": "pip install pytest>=6.0",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use caplog.record_tuples instead of caplog.records for backward compatibility.",
      "success_rate": 0.85,
      "how": "assert ('module', logging.INFO, 'message') in caplog.record_tuples",
      "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.83,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-02-28",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}