python
config_error
ai_generated
true
Usage: pytest [options] [file_or_dir] [file_or_dir] [...] pytest: error: unrecognized arguments: --foo
ID: python/pytest-option-error
80%Fix Rate
87%Confidence
0Evidence
2024-06-20First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 7.x | active | — | — | — |
| 8.x | active | — | — | — |
Root Cause
在命令行或pytest.ini中使用了pytest不认识的选项,可能是拼写错误或需要插件。
generic中文
在命令行或pytest.ini中使用了pytest不认识的选项,可能是拼写错误或需要插件。
Workarounds
-
90% success
pytest --help | grep foo
-
85% success
pip install pytest-foo
Dead Ends
Common approaches that don't work:
-
50% fail
pytest会继续报错,且可能忽略重要配置
-
40% fail
--help只列出已知选项,不能解决未知选项