# pytest.PytestDeprecationWarning: 'func' 参数已弃用，请改用 'function'

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

## 根因

在 pytest 函数中使用了已弃用的参数，由于 -W error::pytest.PytestDeprecationWarning 过滤器，这被视为错误。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.8 | active | — | — |
| 3.9 | active | — | — |
| 3.10 | active | — | — |
| 3.11 | active | — | — |
| 3.12 | active | — | — |

## 解决方案

1. **** (95% 成功率)
   ```
   Update the code to use the new parameter: replace `func` with `function` in the call.
   ```
2. **** (85% 成功率)
   ```
   Temporarily allow the warning in pytest.ini: `filterwarnings = default::pytest.PytestDeprecationWarning`
   ```

## 无效尝试

- **** — This hides important deprecation notices that should be addressed for future compatibility. (80% 失败率)
- **** — This is a temporary fix that prevents using newer features and security patches. (90% 失败率)
