第一次在这里发帖,过去 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/