尝试使用 pytest 在 python 3.10 上执行测试时出错

Posted

技术标签:

【中文标题】尝试使用 pytest 在 python 3.10 上执行测试时出错【英文标题】:An error while trying to execute tests on python 3.10 with pytest 【发布时间】:2021-11-30 08:38:22 【问题描述】:

如果我尝试使用带有 python 3.10 的 pytest 执行测试,我收到以下错误 TypeError: required field "lineno" missing from alias 谷歌说这是已知问题,但我没有找到解决方法。 如果我使用 3.9 启动测试,测试开始正常

【问题讨论】:

这已经修复 - 将 pytest 升级到最新版本。 【参考方案1】:

pytest version 6.2.5 中似乎已修复此问题。

请看:Fix assertion rewriting on Python 3.10

【讨论】:

以上是关于尝试使用 pytest 在 python 3.10 上执行测试时出错的主要内容,如果未能解决你的问题,请参考以下文章