-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Non-deterministic test collection order for deterministic fixtures makes xdist fail #920
Comments
interesting find, my initial guess is, this is a artifact of the python hash-seed and the fixture management is just sorted different in some mappings it'll take a while to figure the details, and it'll happen after the next release of xdist (which i am working on) |
Yea, the test collection mechanism is a bit flaky – in a much larger example which I won't be able to reproduce here I was able to work around it by changing some fixtures from session-scoped to function-scoped, I have no clue why that helped. Also, this doesn't seem to happen on Python 2 (not that I've seen it fail, at least). By the way, I wonder why should it care about the order at all if the sets are the same? |
That goes a few years back, I recall its a workaround for duplicate test ids or something like that |
@aldanor FYI I fail to be able to reproduce the failure using the example code you provided. My software: Python 2.7.9 and 3.5.1, pytest 2.9.1, xdist-1.14. |
Hmm perhaps we can pass |
I'm seeing this while trying to move away from
this is my environment:
Edit: to be clear, this works fine:
|
Fixture collection is not deterministic in the presence of hash randomisation, so seed the hash so that we can run tests in parallel.
Fixture collection is not deterministic in the presence of hash randomisation, so seed the hash so that we can run tests in parallel.
Fixture collection is not deterministic in the presence of hash randomisation, so seed the hash so that we can run tests in parallel.
Fixture collection is not deterministic in the presence of hash randomisation, so seed the hash so that we can run tests in parallel.
I think we still see this in our project with pytest 3.2 and xdist 1.18.2: |
@renemilk the issue you show is a different problem that comes from your own self-made parametrization system all your tests that differ in order may be in a different place based on pythonhashseed |
Ah, ok. I misunderstood then. Setting |
I think I may have the same issue. I dynamically generate parameterization based on a txt file from S3: def parametrize_tenant_from_s3_file(metafunc):
file_path = metafunc.config.getoption('--tenant-list-file')
profile_name = metafunc.config.getoption('--aws-profile-name')
aws_session = AWSSession(profile_name=profile_name)
s3 = S3(aws_session.session)
parsed_link = parse.urlparse(file_path)
file_name = Path.cwd() / 'tenant_list.txt'
s3.download_file(bucket=parsed_link.netloc, key=parsed_link.path.lstrip('/'), path=file_name)
metafunc.parametrize('tenant_id_from_s3_file', file_name.read_text().splitlines()) Running this without
With
I tried setting PYTHONSEEDHASH to no avail. EDIT: Realised I wasn't on latest xdist and pytest, upgrade both to latest, still same issue. |
@liiight based on what you show its a completely different issue please open new issues instead of recycling related looking but actually fixed issues |
Will do.
…On Mon, Jan 21, 2019, 18:30 Ronny Pfannschmidt ***@***.*** wrote:
@liiight <https://github.com/liiight> based on what you show its a
completely different issue please open new issues instead of recycling
related looking but actually fixed issues
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#920 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AELANb2eTnC2O2rAXOrzTVTGSwIVmKkiks5vFesQgaJpZM4Fm6YP>
.
|
I just encountered this issue while collecting tests with parametrized fixtures (
|
Issues that may be related: #437, #594, #596, #669.
pytest-xdist
seems to fail sometimes because it orders parametrized fixtures differently -- e.g., when a fixture depends on two or more parametrized fixtures. Using the latest pytest and pytest-xdist on Python 3.4 with this test script:Sometimes it works:
And sometimes it doesn't (because it chose to sort the fixtures by the second parameter first for some reason):
The text was updated successfully, but these errors were encountered: