python install_error ai_generated true

ImportError: Error importing plugin "pytest_mock": No module named 'pytest_mock'

ID: python/pytest-import-mode-error

Also available as: JSON · Markdown · 中文
80%Fix Rate
88%Confidence
0Evidence
2024-09-05First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
7.x active
8.x active

Root Cause

pytest尝试加载未安装的插件,或者插件名拼写错误。

generic

中文

pytest尝试加载未安装的插件,或者插件名拼写错误。

Workarounds

  1. 95% success
    pip install pytest-mock
  2. 90% success
    移除或修正addopts中的插件名

Dead Ends

Common approaches that don't work:

  1. 50% fail

    pytest本身已安装,问题在于插件

  2. 60% fail

    禁用插件会丢失功能