Skip to content
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

Use vendored check_figures_equal decorator function #579

Open
weiji14 opened this issue Sep 4, 2020 · 3 comments
Open

Use vendored check_figures_equal decorator function #579

weiji14 opened this issue Sep 4, 2020 · 3 comments
Labels
longterm Long standing issues that need to be resolved maintenance Boring but important stuff for the core devs

Comments

@weiji14
Copy link
Member

weiji14 commented Sep 4, 2020

Description of the desired feature

This is a medium to long term maintenance issue with the check_figures_equal function at pygmt/helpers/testing.py, which is pretty much an exact copy of matplotlib's check_figures_equal function. Ideally, we would just use a vendored function from matplotlib or pytest-mpl instead of writing our own.

Yes, which was partly why I opened up the issue at matplotlib/pytest-mpl#94, to get all of that pytest-mpl goodness (e.g. not having a hardcoded result_dir). I'll try to make a Pull Request to pytest-mpl for that, so we can just use a proper @pytest.mark.mpl_check_equal decorator in the future (will open a new issue after this one is merged). For now though, since we don't have many tests using check_figures_equal yet, we can probably just leave it like so.

Originally posted by @weiji14 in #555 (comment)

Are you willing to help implement and maintain this feature? Yes, PR in the works at matplotlib/pytest-mpl#95.

@weiji14 weiji14 added maintenance Boring but important stuff for the core devs longterm Long standing issues that need to be resolved labels Sep 4, 2020
@willschlitzer
Copy link
Contributor

@weiji14 It looks like Option 2 at over your pytest-mpl pull request is the same syntax as what we currently use for @check_figures_equal. Assuming your pull request is merged, would the only real change for PyGMT tests be different import statements to use the decorator?

@seisman
Copy link
Member

seisman commented Nov 26, 2024

Currently, check_figures_equal is only used in the test_grdimage.py file (https://github.com/search?q=repo%3AGenericMappingTools%2Fpygmt%20check_figures_equal&type=code). I'm wondering if we can fully get rid of check_figures_equal and always use mpl_image_compare instead.

@weiji14
Copy link
Member Author

weiji14 commented Nov 26, 2024

I would probably keep check_figures_equal until we fix #390, and can be confident that plotting from a NetCDF file vs an xarray.DataArray is always the same.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
longterm Long standing issues that need to be resolved maintenance Boring but important stuff for the core devs
Projects
None yet
Development

No branches or pull requests

3 participants