{
  "id": "python/pytest-caplog-not-capturing",
  "signature": "AssertionError: assert 'expected message' in []",
  "signature_zh": "AssertionError: assert 'expected message' in []",
  "regex": "AssertionError:\\ assert\\ 'expected\\ message'\\ in\\ \\[\\]",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "The caplog fixture did not capture any log records because the logger's level is higher than the log message level, or the logger is not propagating to the root logger.",
  "root_cause_type": "generic",
  "root_cause_zh": "caplog 夹具未捕获任何日志记录，因为记录器的级别高于日志消息级别，或者记录器未传播到根记录器。",
  "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": "The level must be set before the log call. Setting it after has no effect on already-emitted records.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This bypasses the logging system entirely and does not test the actual logging behavior. It also clutters test output.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.92,
      "how": "def test_logging(caplog):\n    caplog.set_level(logging.INFO)\n    my_function()\n    assert 'expected message' in caplog.text",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.88,
      "how": "logger = logging.getLogger('myapp')\nlogger.propagate = True\n# Or use caplog.set_level with the specific logger name",
      "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.89,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-06-30",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}