使用 pytest 执行测试用例时,可能会遇到以下错误:

'AttributeError: 'FixtureLookupErrorRepr' object has no attribute 'reprcrash''

这个错误通常是由于 pytest 版本不兼容导致的。

解决方法:

  1. 卸载当前的 pytest,使用 pip install pytest==5.4.3 安装较为稳定的版本。

  2. 检查你的代码中是否有重复的 fixture 名称,如果有,需要将其改为不同的名称。

  3. 如果以上两个方法都无法解决问题,可以尝试更新 pytest 到最新版本。

pytest 测试用例执行报错:AttributeError: 'FixtureLookupErrorRepr' object has no attribute 'reprcrash'