From 81a932d80a9a840d05b93736e0839f936f1978b8 Mon Sep 17 00:00:00 2001 From: Greg Lucas Date: Mon, 17 Jul 2023 07:41:13 -0600 Subject: [PATCH] TST: Avoid contour warning for MPL3.8 --- lib/cartopy/tests/mpl/test_caching.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/cartopy/tests/mpl/test_caching.py b/lib/cartopy/tests/mpl/test_caching.py index e8b3ebfd1..5469f6ecd 100644 --- a/lib/cartopy/tests/mpl/test_caching.py +++ b/lib/cartopy/tests/mpl/test_caching.py @@ -22,6 +22,7 @@ from cartopy.mpl.feature_artist import FeatureArtist import cartopy.mpl.geoaxes as cgeoaxes import cartopy.mpl.patch +from cartopy.tests.mpl import MPL_VERSION def sample_data(shape=(73, 145)): @@ -120,7 +121,11 @@ def test_contourf_transform_path_counting(): with mock.patch('cartopy.mpl.patch.path_to_geos') as path_to_geos_counter: x, y, z = sample_data((30, 60)) cs = ax.contourf(x, y, z, 5, transform=ccrs.PlateCarree()) - n_geom = sum(len(c.get_paths()) for c in cs.collections) + if MPL_VERSION.release[:2] < (3, 8): + n_geom = sum(len(c.get_paths()) for c in cs.collections) + else: + n_geom = len(cs.get_paths()) + del cs fig.canvas.draw()