python - ImportError:使用 pytest 进行测试时无法导入名称“transfer_markers”
问题描述
当我通过运行以下命令为我的 python 项目运行测试时:
python setup.py test
(or)
pytest project_name
我收到以下错误:
.../project_name/.eggs/pytest_asyncio-0.9.0-py3.6.egg/pytest_asyncio/plugin.py", line 8, in <module>
from _pytest.python import transfer_markers
ImportError: cannot import name 'transfer_markers'
解决方案
当我在网上查到它时,几乎没有任何地方提到那个特定的错误消息。类似的事情发生在我身上好几次了,以前工作的代码刚刚中断,这通常是因为有一个重要包的新版本。
我查看了pytest release history,它看起来像是pytest==4.1.0
几个小时前发布的(截至本文为止)。
pytest==4.0.2
解决方案是通过运行以下命令恢复到 pytest 的最后一个稳定版本:
pip install pytest==4.0.2
测试现在正在运行。
推荐阅读
- angular - Angular Material - 对 mat-table 的数据进行排序
- r - 在 Shiny 中显示文本进度条
- linux - 我必须使用什么来代替 gnome 桌面环境来使用 qt 在 i.mx6 上运行虚拟键盘?
- python-3.x - 在 Python3 中通过 Pickle 加载模型时出错
- aws-cdk - 向 AwsCustomResource 添加条件
- python - 如何将此 python 文档转换为用于 selenium webdriver 的 nodejs
- postgresql - 将十六进制转换为日期格式 utc-5 Postgresql
- woocommerce - Woocommerce 单一产品页面:恢复默认布局/设计
- c# - 我的方法 PurchaseVents() 正在获取变量 totalCost12 和 vCountAmount 的值 = 0,而不是它们在函数 AddCount() 中获得的值
- fluentui-react - 如何重置 Fluent UI 选择组选择