diff --git a/8186.patch b/8186.patch new file mode 100644 index 0000000..c141ce9 --- /dev/null +++ b/8186.patch @@ -0,0 +1,29 @@ +From c7391fca66e1fd24b175cfffab692af20628fe2b Mon Sep 17 00:00:00 2001 +From: Kyle Sunden +Date: Thu, 14 Sep 2023 20:18:04 -0500 +Subject: [PATCH] Update contourf call check for mpl 3.8 + +--- + xarray/tests/test_plot.py | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/xarray/tests/test_plot.py b/xarray/tests/test_plot.py +index 8b2dfbdec4..a6c15a8600 100644 +--- a/xarray/tests/test_plot.py ++++ b/xarray/tests/test_plot.py +@@ -167,7 +167,14 @@ def imshow_called(self, plotmethod): + + def contourf_called(self, plotmethod): + plotmethod() +- paths = plt.gca().findobj(mpl.collections.PathCollection) ++ ++ # Compatible with mpl before (PathCollection) and after (QuadContourSet) 3.8 ++ def matchfunc(x): ++ return isinstance( ++ x, (mpl.collections.PathCollection, mpl.contour.QuadContourSet) ++ ) ++ ++ paths = plt.gca().findobj(matchfunc) + return len(paths) > 0 + + diff --git a/python-xarray.spec b/python-xarray.spec index 7e65eb4..d4cd36a 100644 --- a/python-xarray.spec +++ b/python-xarray.spec @@ -16,6 +16,8 @@ Source1: https://github.com/pydata/xarray-data/archive/%{data_commit}/xar # All Fedora specific. Patch0001: 0001-DOC-Skip-examples-using-unpackaged-dependencies.patch Patch0002: 0002-DOC-Don-t-print-out-conda-pip-environment.patch +# Fix tests with Matplotlib 3.8.0. +Patch0003: https://github.com/pydata/xarray/pull/8186.patch BuildArch: noarch