diff --git a/lib/cartopy/tests/mpl/conftest.py b/lib/cartopy/tests/mpl/conftest.py index 60f172364..03f307562 100644 --- a/lib/cartopy/tests/mpl/conftest.py +++ b/lib/cartopy/tests/mpl/conftest.py @@ -35,5 +35,6 @@ def pytest_itemcollected(item): return elif path.basename == 'tests': subdir = item.fspath.relto(path)[:-len(item.fspath.ext)] - mpl_marker.kwargs['baseline_dir'] = f'baseline_images/{subdir}' + mpl_marker.kwargs.setdefault('baseline_dir', + f'baseline_images/{subdir}') break diff --git a/lib/cartopy/tests/mpl/test_gridliner.py b/lib/cartopy/tests/mpl/test_gridliner.py index 515c594e3..e75102cff 100644 --- a/lib/cartopy/tests/mpl/test_gridliner.py +++ b/lib/cartopy/tests/mpl/test_gridliner.py @@ -454,17 +454,23 @@ def test_gridliner_count_draws(): mocked.assert_called_once() +@pytest.mark.mpl_image_compare( + baseline_dir='baseline_images/mpl/test_mpl_integration', + filename='simple_global.png') def test_gridliner_remove(): fig = plt.figure() ax = fig.add_subplot(1, 1, 1, projection=ccrs.PlateCarree()) ax.set_global() + ax.coastlines() gl = ax.gridlines(draw_labels=True) fig.draw_without_rendering() # Generate child artists gl.remove() - assert not ax.artists + assert gl not in ax.artists assert not ax.collections + return fig + def test_gridliner_save_tight_bbox(): # Smoke test for save with auto_update=True and bbox_inches=Tight (gh2246).