python
config_error
ai_generated
true
pytest.PytestDeprecationWarning: The 'func' argument is deprecated, use 'function' instead
ID: python/pytest-warning-as-error
80%Fix Rate
85%Confidence
0Evidence
2025-06-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 3.8 | active | — | — | — |
| 3.9 | active | — | — | — |
| 3.10 | active | — | — | — |
| 3.11 | active | — | — | — |
| 3.12 | active | — | — | — |
Root Cause
Using a deprecated parameter in a pytest function, which is treated as an error due to the -W error::pytest.PytestDeprecationWarning filter.
generic中文
在 pytest 函数中使用了已弃用的参数,由于 -W error::pytest.PytestDeprecationWarning 过滤器,这被视为错误。
Workarounds
-
95% success
Update the code to use the new parameter: replace `func` with `function` in the call.
-
85% success
Temporarily allow the warning in pytest.ini: `filterwarnings = default::pytest.PytestDeprecationWarning`
Dead Ends
Common approaches that don't work:
-
80% fail
This hides important deprecation notices that should be addressed for future compatibility.
-
90% fail
This is a temporary fix that prevents using newer features and security patches.