TST: Use explicit style in all image_comparison calls#31148
TST: Use explicit style in all image_comparison calls#31148QuLogic merged 1 commit intomatplotlib:mainfrom
Conversation
5ac6017 to
85a4a72
Compare
|
|
||
| @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
3f4bc2c to
de1e5d8
Compare
|
Sorry, followup question, is |
|
https://github.com/search?q=matplotlib.testing+.decorators+language%3APython&type=code This search says even if we did not want it to be, it is. I would proprose
|
45440d3 to
7207881
Compare
|
Funnily enough, this one overrides ours to set |
|
@QuLogic can self-merge after fixing the docs/linting issue. |
Due to the warning and our default to set warnings to errors, this makes it so that future tests *must* use the new style (or explicitly opt in to the old), and in the future, we will 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
c03b703 to
47f5e22
Compare
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