# AssertionError: assert 'expected log' in []

- **ID:** `python/pytest-caplog-no-logs`
- **领域:** python
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

caplog fixture 未捕获任何日志消息，通常是因为日志级别过高或日志记录器未配置。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.x | active | — | — |

## 解决方案

1. **** (95% 成功率)
   ```
   caplog.set_level(logging.INFO)
Ensure the logger used in the code under test has propagate=True (default) and is not filtered.
   ```
2. **** (90% 成功率)
   ```
   with caplog.at_level(logging.INFO):
    my_function()
assert 'expected log' in caplog.text
   ```

## 无效尝试

- **** — If the logger is not configured to propagate or the handler is missing, increasing the level may not help. (70% 失败率)
- **** — This does not test the logging behavior and is not a proper fix. (90% 失败率)
