python - Pytest Xdist 不同的测试被收集错误

标签 python pytest xdist pytest-xdist

第一次在这里发帖,过去 2 天我尝试搜索 xdist 问题的解决方案。当我尝试使用 n=2 或更高的值运行时,有时(我说有时是因为它随机工作)会出现类似

的错误
Different tests were collected between gw1 and gw0. The difference is:
--- gw1

+++ gw0

@@ -1,2 +1,2 @@

+test_Sign_Up.py::test_sign_up[chrome]  test_Sign_Up.py::test_sign_up[firefox]
-test_Sign_Up.py::test_sign_up[chrome]

如果这很容易解决,我深表歉意,但在看了这么多其他帖子后,我个人觉得我没有找到我的答案。如果需要更多信息,请告诉我,我会尽快回复!谢谢你!

编辑:设置

Python 3.5.3
Pytest 3.1.2
Xdist 1.17.1

最佳答案

如果使用最近发布的 pytest 3.2 不能修复您的错误,请尝试使用固定数字为 python 解释器的散列播种以获得依赖于散列的结构的稳定排序: PythonHASHSEED=0 pytest -n 2

关于python - Pytest Xdist 不同的测试被收集错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44708770/

相关文章:

python - 从没有掩码 pandas 的条件语句创建新列

python - 返回二维张量每行的 top_k masked softmax

python - 为整个存储库动态创建测试文件模板

python - 为什么 pytest + xdist 不捕获输出?

python - 在 Django 通用 View 中指定不同的模板名称

python - 从 SFTP 服务器打开 Astropy FITS 文件

Python 覆盖率报告仅覆盖测试文件

python - 如何在 Python 中对需要事件 Click 上下文的函数进行单元测试

python - 安装 pytest-xdist 后 Pytest 无法识别 -n 选项

python - pytest:如何在 session 结束时获取所有失败测试的列表? (并且在使用 xdist 时)