pytest 测试用例执行报错:AttributeError: 'FixtureLookupErrorRepr' object has no attribute 'reprcrash'
使用 pytest 执行测试用例时,可能会遇到以下错误:
'AttributeError: 'FixtureLookupErrorRepr' object has no attribute 'reprcrash''
这个错误通常是由于 pytest 版本不兼容导致的。
解决方法:
-
卸载当前的 pytest,使用
pip install pytest==5.4.3安装较为稳定的版本。 -
检查你的代码中是否有重复的 fixture 名称,如果有,需要将其改为不同的名称。
-
如果以上两个方法都无法解决问题,可以尝试更新 pytest 到最新版本。
AI 优化版
原文地址:https://www.cveoy.top/t/topic/ofNR 著作权归作者所有。请勿转载和采集!