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

Also available as: JSON · Markdown · 中文
80%Fix Rate
87%Confidence
0Evidence
2024-06-20First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
7.x active
8.x active

Root Cause

在命令行或pytest.ini中使用了pytest不认识的选项,可能是拼写错误或需要插件。

generic

中文

在命令行或pytest.ini中使用了pytest不认识的选项,可能是拼写错误或需要插件。

Workarounds

  1. 90% success
    pytest --help | grep foo
  2. 85% success
    pip install pytest-foo

Dead Ends

Common approaches that don't work:

  1. 50% fail

    pytest会继续报错,且可能忽略重要配置

  2. 40% fail

    --help只列出已知选项,不能解决未知选项