python config_error ai_generated true

UsageError: provided markers not found in collection: ['slow']

ID: python/pytest-marker-expression-error

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

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
7.4.0 active

Root Cause

使用 -m 参数指定标记,但测试中没有定义该标记

generic

中文

使用 -m 参数指定标记,但测试中没有定义该标记

Workarounds

  1. 95% success
    在 pytest.ini 中添加 markers = slow: 慢速测试
  2. 80% success
    pytest --markers 列出所有可用标记

Dead Ends

Common approaches that don't work:

  1. 30% fail

    如果标记未注册,pytest 仍会警告

  2. 90% fail

    导致没有测试运行