TST: Use explicit style in all image_comparison calls#31148
TST: Use explicit style in all image_comparison calls#31148QuLogic wants to merge 1 commit intomatplotlib:mainfrom
Conversation
5ac6017 to
85a4a72
Compare
lib/matplotlib/tests/test_agg.py
Outdated
|
|
||
| @image_comparison(['agg_filter.png'], remove_text=True) | ||
| @image_comparison(['agg_filter.png'], remove_text=True, | ||
| style=('classic', '_classic_test_patch')) |
There was a problem hiding this comment.
Should we create a new style _classic_test? This feels overly verbose.
There was a problem hiding this comment.
I'm not sure that we have a way to create a kind of inheritance that would work like that. If we made a completely new one, we'd be duplicating most of classic with the 2 or 3 lines of _classic_test_patch differing.
There was a problem hiding this comment.
Could we dynamically create _classic_test.mplstyle by merging the two files at test startup? Or check it in and write a test that it's just the merge of the two?
There was a problem hiding this comment.
Yes, the former seems quite plausible.
There was a problem hiding this comment.
@QuLogic I thought about how to document this for debugging (=I want to manually create the same image as in a test). We basically have to state: When running manually, use ('classic', '_classic_test_patch') instead of '_classic_test'.
That brought me to the idea that instead of doing magic at test setup, we could alternatively rewrite the value '_classic_test' to ('classic', '_classic_test_patch'). Not sure which one is better.
There was a problem hiding this comment.
There's more than just the style; we do a few other things as part of test setup:
matplotlib/lib/matplotlib/testing/__init__.py
Lines 30 to 52 in cb63559
The best way to create a test image is by running an image_comparison and looking at the result image.
85a4a72 to
a18b014
Compare
a18b014 to
ec3a2df
Compare
|
Note, I've decided to wait until the |
ec3a2df to
3f4bc2c
Compare
This makes it so that future tests *must* use the new style (or explicitly opt in to the old), and in the future, we may return to a default of that one instead. As a shortcut, the `_classic_test` style is generated from `classic` and `_classic_test_patch` at test startup. Fixes matplotlib#24716
3f4bc2c to
de1e5d8
Compare
|
Sorry, followup question, is |
PR summary
This makes it so that future tests must use the new style (or explicitly opt in to the old), and in the future, we may return to a default of that one instead.
I used a
libcsttransform to add the kwarg in alphabetical order, so some bits of the diff might be suboptimal in their succinctness, but they should be all consistent.Fixes #24716
This is based on #31137.
PR checklist