TypeError: attrib() 得到了一个意外的关键字参数 'convert'

新手上路,请多包涵

此错误发生在使用 pytest 对 CI 服务器上的 python 项目进行自动测试期间。我正在使用 pytest==4.0.2 。这个错误才刚刚开始出现,以前的管道似乎工作正常。

完整错误:

 File "/usr/local/lib/python3.7/site-packages/_pytest/tmpdir.py", line 35, in TempPathFactory
    lambda p: Path(os.path.abspath(six.text_type(p)))
TypeError: attrib() got an unexpected keyword argument 'convert'

原文由 nitred 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 1.3k
2 个回答

pytest 似乎有包 attrs 作为依赖项。 attrs==19.2.0 围绕 2019-10-01 17:00 UTC 发布。这似乎导致了上面的问题。

切换回 attrs==19.1.0 解决了这个问题。只需执行以下操作:

 pip install attrs==19.1.0

注意:我希望这个问题将通过 attrspytest 很快通过发布新版本来解决。所以这个修复应该只是暂时的。

来自评论:此错误不会发生在较新版本的 pytest ie pytest==5.2.0

原文由 nitred 发布,翻译遵循 CC BY-SA 4.0 许可协议

推荐问题