{{ message }}
TST: force test with shared test image to run in serial - #24081
Merged
Conversation
The tests test_hexbin_empty and test_hexbin_log_empty use the same target image, however if they the tests ended up being run in different workers when running the tests in parallel they will step on each other if one of the test starts writing the output file while the other is trying to read the test image. By putting them in the same test they will save and evaluate in order.
timhoffm
approved these changes
Oct 3, 2022
timhoffm
left a comment
Member
There was a problem hiding this comment.
I think either way is good enough here. Please add a comment that they have to be together, so that nobody comes along and splits the test later. - Thinking about it, given the need for a note to prevent future breakage and related complexity/mental load, maybe copying the image is the easier solution.
Theoretically, the best solution would be to solve this on the test infrastructure level. Conceptually, there should not be a problem with multiple tests using the same reference image - the reference image should be read-only. But maybe fixing this is more effort than it's worth. It's not that common that multiple tests generate the same image.
Member
Author
Member
meeseeksmachine
pushed a commit
to meeseeksmachine/matplotlib
that referenced
this pull request
Oct 17, 2022
…to run in serial
QuLogic
added a commit
that referenced
this pull request
Oct 17, 2022
…081-on-v3.6.x Backport PR #24081 on branch v3.6.x (TST: force test with shared test image to run in serial)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

PR Summary
The tests test_hexbin_empty and test_hexbin_log_empty use the same target image, however if they the tests ended up being run in different workers when running the tests in parallel they will step on each other if one of the test starts writing the output file while the other is trying to read the test image.
By putting them in the same test they will save and evaluate in order.
I verified I could break both tests.
The other option here is to make a copy of the file (which should be free at the git level due to content based addressing). I am happy to switch to that if the consensus that is a better approach happy to switch (I was very much on the fence).
This should fix the current rash of transient failures. We are running
-n 2on CI so we need to get unlucky that the tests go to different workers and that they run close enough in time to matter which is why we only see in 1-2 jobs per CI run and re-running seems to reliably fix it.PR Checklist
Tests and Styling
pytestpasses).flake8-docstringsand runflake8 --docstring-convention=all).