# Pytest 配置警告：未知配置选项 filterwarnings

- **ID:** `python/pytest-warning-filter-error`
- **领域:** python
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

pytest.ini 或 pyproject.toml 中配置了错误的 filterwarnings 语法

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 7.4.0 | active | — | — |

## 解决方案

1. **** (90% 成功率)
   ```
   在 pytest.ini 中使用 filterwarnings = error::DeprecationWarning
   ```
2. **** (85% 成功率)
   ```
   pytest -W error::DeprecationWarning
   ```

## 无效尝试

- **** — 警告可能掩盖实际问题 (30% 失败率)
- **** — 无法控制警告，测试输出混乱 (40% 失败率)
