python
config_error
ai_generated
true
用法:pytest [选项] [文件或目录] [文件或目录] [...] pytest:错误:无法识别的参数:--foo
Usage: pytest [options] [file_or_dir] [file_or_dir] [...] pytest: error: unrecognized arguments: --foo
ID: python/pytest-option-error
80%修复率
87%置信度
0证据数
2024-06-20首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| 7.x | active | — | — | — |
| 8.x | active | — | — | — |
根因分析
在命令行或pytest.ini中使用了pytest不认识的选项,可能是拼写错误或需要插件。
English
在命令行或pytest.ini中使用了pytest不认识的选项,可能是拼写错误或需要插件。
解决方案
-
90% 成功率
pytest --help | grep foo
-
85% 成功率
pip install pytest-foo
无效尝试
常见但无效的做法:
-
50% 失败
pytest会继续报错,且可能忽略重要配置
-
40% 失败
--help只列出已知选项,不能解决未知选项