Improve image comparison decorator#17267
Merged
timhoffm merged 4 commits intomatplotlib:masterfrom May 5, 2020
Merged
Conversation
anntzer
reviewed
Apr 30, 2020
| marker.args[0] not in {'extension'} | ||
| for marker in request.node.iter_markers('parametrize')) | ||
|
|
||
| if baseline_images is not None: |
Contributor
There was a problem hiding this comment.
just do if baseline_images is None: baseline_images = request.getfixturevalue(...)?
Member
Author
There was a problem hiding this comment.
That causes a read-before-use error on the variable, though maybe it'd work if marked non-local? It didn't need to modify the external variable so I didn't try that.
timhoffm
reviewed
May 3, 2020
anntzer
approved these changes
May 3, 2020
It saves a couple lines to add-if-needed, instead of remove-if-unneeded.
Namely, use signature manipulation, instead of an indirection via fixtures, to add `extension` and `request`. Also, use the closure of `baseline_images`, instead of passing it indirectly by marker.
This should prevent tests (if run with xdist) from overwriting each other's files in the middle of checking them.
timhoffm
approved these changes
May 5, 2020
5 tasks
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
Firstly, re-write the parameter indirection in
image_comparisonto use signature modifications, likecheck_figures_equal. Secondly add a lock file for any comparisons that are externally parametrized.We've been seeing
test_loglog_nonposfail a lot on macOS, and this should help with that case. Since there's now a lock, revert some of my previous workarounds to avoid parallel writes.mpl_image_comparison_parametersis no longer used, but I'm not sure if we considermatplotlib.testing.conftestpublic or whether I can just remove it. It's really only useful when applied viaimage_comparison.PR Checklist