-
Notifications
You must be signed in to change notification settings - Fork 232
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
Different tests were collected between gw0 and gw1 #432
Comments
As I understand it, xdist started test 2 times, and the test data generator also worked 2 times. Xdist doesn't like it. And we have to use a static JSON file with test data. We need to make the generation of this data in the fixture, not in the body of the test. |
I am also running into this issue when using tests that do fuzzing. It would be very useful if there was a way to disable the "generating tests twice must produce identical tests" check. For example, given this test code in a file
This command passes:
And this command fails:
With an error similar to this one:
Oddly, with one parameter instead of two the test will pass even with |
Hi, Sorry for the delay!
Yes, each worker performs a standard collection, and sends the collected test ids (in order) back to the master node. The master node ensures every worker collected the same number of tests and in the same order, because the scheduler will from that point on send just the test indexes (not the entire node id) to each worker to tell them which test to execute. That's why the collection must be the same across all workers.
As explained above, unfortunately it is not a simple check, but a central design point how the scheduler and workers interact. |
Hi, what is the solution to this? I also have: @pytest.mark.parametrize("env", Envs.get_all_latest_envs())
def test_envs_all(env):
gym.make(env) where I am trying to test an agent on a bunch of environments. Different tests were collected between gw0 and gw1. I'm getting a similar error.
|
@josiahls Try using |
edit, moved my comment to a new issue #472 |
Had this issue, fixed with sorting the parameters
|
…described here: pytest-dev/pytest-xdist#432 DOC: fixed typo in comment, made abbreviations for n-dimensional consistent
I have also been having this issue with parametrized tests, Possibly relevant :
Relevant to this PR at present .. SciTools/iris#4960 Main package versions Using :
Basically I'm stumped -- I'm not clear why sorting didn't seem to solve it, possibly something else is going on. |
UPDATE: in addition to sorted parameters, tried numbering the tests (which are in a common class), so that their alphabetic order is now the same as the order of definitions in the class. And that just worked 😮 |
…test-xdist. Don't use random parameters in `pytest.mark.parametrize()`, as it can confuse the pytest-xdist extension; see pytest-dev/pytest-xdist#432 Closes scipygh-17468.
also stumbled over this issue. |
Ah, I have just installed pytest-randomly, and it works. |
Stumbled on this issue and with pytest-randomly installed, it works fine. |
@nicoddemus i believe the only action we can take is to document that if people use random objects as test id's |
I have a valid case where it can happen, can't we disable this check ? |
There's no valid case to have randomized test ids |
I have a simple test with parametrization:
And simple generator of test data for parametrezation:
When i launch test with additional argument:
-n 2
I get this error message:
Tell me please what could be the problem
The text was updated successfully, but these errors were encountered: