Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatability with pytest pytest-xdist==1.30.0 #201

Closed
therefromhere opened this issue Oct 2, 2019 · 8 comments · Fixed by #245
Closed

Compatability with pytest pytest-xdist==1.30.0 #201

therefromhere opened this issue Oct 2, 2019 · 8 comments · Fixed by #245

Comments

@therefromhere
Copy link

FYI I think there's a compatibility issue with pytest-xdist==1.30.0, see pytest-dev/pytest-xdist#472

@adamchainz
Copy link
Member

We don't currently test with xdist, if you are working on this I think it'd be good to have some tests here using it.

@thedrow
Copy link

thedrow commented Apr 13, 2020

Seems like xdist works in 1.31.0.

@adamchainz
Copy link
Member

Thanks @thedrow . Will close this issue then.

@nodakai
Copy link

nodakai commented Apr 15, 2020

No, the issue is still there (I'm not saying pytest-randomly has to do anything for this issue but just for the sake of recoding...)

test/test_0.py

def test_a(): pass

test/test_1.py

def test_b(): pass
$ while pytest -d --tx 2*popen test; do sleep 1; done
(after several successes...)
========================================== test session starts ===========================================
platform linux -- Python 3.7.6, pytest-5.4.1, py-1.8.1, pluggy-0.13.1
Using --randomly-seed=1586915652
rootdir: /home/kai/tst
plugins: forked-1.1.3, randomly-3.2.1, xdist-1.31.0
gw0 [2] / gw1 [2]
collecting 0 items / 1 error                                                                             
================================================= ERRORS =================================================
__________________________________________ ERROR collecting gw1 __________________________________________
Different tests were collected between gw0 and gw1. The difference is:
--- gw0

+++ gw1

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

+test/test_0.py::test_a
 test/test_1.py::test_b
-test/test_0.py::test_a
======================================== short test summary info =========================================
ERROR gw1
============================================ 1 error in 0.37s ============================================

There's some indeterminacy here

@adamchainz adamchainz reopened this Apr 15, 2020
adamchainz added a commit that referenced this issue Apr 15, 2020
adamchainz added a commit that referenced this issue Apr 15, 2020
adamchainz added a commit that referenced this issue Apr 15, 2020
@adamchainz
Copy link
Member

Thanks for the example @nodakai . With that I was able to figure out what the problem was - the workers would sometimes not share the same default seed, since it's based on int(time.time()) and sometimes workers would start across the second boundary. This is, of course, a random error 😂

Fixed in #245 and released in version 3.3.0 ! 🎲🎉

@therefromhere
Copy link
Author

Awesome!

@fermezz
Copy link

fermezz commented May 12, 2020

@adamchainz would you guys be open to a contribution backporting this fix into the 1.2.x branch? Since pytest-dev/pytest#6870 was merged, now pytest-randomly on version 1.2.x –the one compatible with Python2– is incompatible with pytest version >=4.6.10

@adamchainz
Copy link
Member

I don't work with Python 2.7 more (at least, for free). If you want a backport please fork, cherry-pick the commit, and pip install from your repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants