python config_error ai_generated true

错误:无法识别的参数:--tst

ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...] pytest: error: unrecognized arguments: --tst

ID: python/pytest-command-line-option-typo

其他格式: JSON · Markdown 中文 · English
80%修复率
85%置信度
0证据数
2025-10-18首次发现

版本兼容性

版本状态引入弃用备注
3.10 active

根因分析

在命令行中使用了不存在的 pytest 选项,通常因为拼写错误或插件未加载。

English

在命令行中使用了不存在的 pytest 选项,通常因为拼写错误或插件未加载。

generic

解决方案

  1. 95% 成功率 确认选项存在
    检查拼写,使用 pytest --help 查看可用选项
  2. 90% 成功率 安装插件
    安装相应插件,如 pytest-cov 提供 --cov

无效尝试

常见但无效的做法:

  1. 使用 --help 40% 失败

    尝试使用 --help 查看所有选项但可能忽略插件选项

  2. 自定义选项注册错误 60% 失败

    尝试在 conftest.py 中添加自定义选项但未正确注册