Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pytest Xdist different tests were collected error

First time posting here, and I've tried to search these past 2 days for a solution to my problem with xdist. When I try to run with n=2 or anything higher, I sometimes (I say sometimes because it works randomly) get an error along the lines of

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]

Apologies if this is something simple to fix, but after looking at so many other posts I personally felt that I did not find my answer. If more info is needed then please let me know and I'll try to get back to it as quickly as possible! Thank you!

Edit: Setup

Python 3.5.3
Pytest 3.1.2
Xdist 1.17.1
like image 726
Jace Romero Avatar asked Sep 19 '25 23:09

Jace Romero


1 Answers

If using the recently released pytest 3.2 does not fix your error, try seeding the the python interpreter's hash with a fixed number to get a stable sorting for structures that rely on hashing: PYTHONHASHSEED=0 pytest -n 2

like image 82
renefritze Avatar answered Sep 21 '25 14:09

renefritze