python config_error ai_generated true

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

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

Also available as: JSON · Markdown · 中文
80%Fix Rate
85%Confidence
0Evidence
2025-10-18First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
3.10 active

Root Cause

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

generic

中文

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

Workarounds

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

Dead Ends

Common approaches that don't work:

  1. 使用 --help 40% fail

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

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

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