Skip to content

Commit

Permalink
TST: Removing unnecessary cleanup decorator
Browse files Browse the repository at this point in the history
This removes the Matplotlib cleanup decorator as we are already handling
the cleanup with the autouse fixture.
  • Loading branch information
greglucas committed Mar 26, 2022
1 parent 66df268 commit 7bf35d9
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 17 deletions.
2 changes: 0 additions & 2 deletions lib/cartopy/tests/mpl/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

from unittest import mock

from matplotlib.testing.decorators import cleanup
import matplotlib.path as mpath
import matplotlib.pyplot as plt
import numpy as np
Expand Down Expand Up @@ -118,7 +117,6 @@ def test_single_geometry(self):
ax.add_geometries(next(cfeature.COASTLINE.geometries()), crs=proj)


@cleanup
def test_geoaxes_subplot():
ax = plt.subplot(1, 1, 1, projection=ccrs.PlateCarree())
assert str(ax.__class__) == "<class 'cartopy.mpl.geoaxes.GeoAxesSubplot'>"
Expand Down
4 changes: 0 additions & 4 deletions lib/cartopy/tests/mpl/test_contour.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# licensing details.

import matplotlib.pyplot as plt
from matplotlib.testing.decorators import cleanup
import numpy as np
from numpy.testing import assert_array_almost_equal
import pytest
Expand All @@ -15,7 +14,6 @@
import cartopy.crs as ccrs


@cleanup
def test_contour_plot_bounds():
x = np.linspace(-2763217.0, 2681906.0, 200)
y = np.linspace(-263790.62, 3230840.5, 130)
Expand Down Expand Up @@ -56,7 +54,6 @@ def test_contour_doesnt_shrink():
assert_array_almost_equal(ax.get_extent(), expected)


@cleanup
def test_contour_linear_ring():
"""Test contourf with a section that only has 3 points."""
ax = plt.axes([0.01, 0.05, 0.898, 0.85], projection=ccrs.Mercator(),
Expand Down Expand Up @@ -98,7 +95,6 @@ def test_contour_update_bounds():


@pytest.mark.parametrize('func', ['contour', 'contourf'])
@cleanup
def test_contourf_transform_first(func):
"""Test the fast-path option for filled contours."""
# Gridded data that needs to be wrapped
Expand Down
2 changes: 0 additions & 2 deletions lib/cartopy/tests/mpl/test_crs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# licensing details.

import matplotlib.pyplot as plt
from matplotlib.testing.decorators import cleanup
import pytest

import cartopy.crs as ccrs
Expand Down Expand Up @@ -46,7 +45,6 @@ def test_lambert_south():


@pytest.mark.natural_earth
@cleanup
def test_repr_html():
pc = ccrs.PlateCarree()
html = pc._repr_html_()
Expand Down
3 changes: 0 additions & 3 deletions lib/cartopy/tests/mpl/test_quiver.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import numpy as np
import matplotlib.pyplot as plt
from matplotlib.testing.decorators import cleanup
import pytest

import cartopy.crs as ccrs
Expand All @@ -28,7 +27,6 @@ def setup_method(self):
self.fig = plt.figure()
self.ax = plt.axes(projection=self.pc)

@cleanup
def test_quiver_transform_xyuv_1d(self):
with mock.patch('matplotlib.axes.Axes.quiver') as patch:
self.ax.quiver(self.x2d.ravel(), self.y2d.ravel(),
Expand All @@ -40,7 +38,6 @@ def test_quiver_transform_xyuv_1d(self):
# Assert that all the shapes have been broadcast.
assert shapes == [(70, )] * 4

@cleanup
def test_quiver_transform_xy_1d_uv_2d(self):
with mock.patch('matplotlib.axes.Axes.quiver') as patch:
self.ax.quiver(self.x, self.y, self.u, self.v, transform=self.rp)
Expand Down
4 changes: 0 additions & 4 deletions lib/cartopy/tests/mpl/test_set_extent.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@
# See COPYING and COPYING.LESSER in the root of the repository for full
# licensing details.

from matplotlib.testing.decorators import cleanup
import matplotlib.pyplot as plt
import numpy as np
from numpy.testing import assert_array_almost_equal, assert_array_equal

import cartopy.crs as ccrs


@cleanup
def test_extents():
# tests that one can set the extents of a map in a variety of coordinate
# systems, for a variety of projection
Expand Down Expand Up @@ -48,7 +46,6 @@ def test_extents():
)


@cleanup
def test_get_extent():
# tests that getting the extents of a map produces something reasonable.
uk = [-12.5, 4, 49, 60]
Expand All @@ -68,7 +65,6 @@ def test_get_extent():
assert_array_almost_equal(ax.get_extent(uk_crs), uk, decimal=1)


@cleanup
def test_domain_extents():
# Setting the extent to global or the domain limits.
ax = plt.axes(projection=ccrs.PlateCarree())
Expand Down
2 changes: 0 additions & 2 deletions lib/cartopy/tests/mpl/test_web_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
# licensing details.

import matplotlib.pyplot as plt
from matplotlib.testing.decorators import cleanup
import pytest

import cartopy.crs as ccrs
Expand All @@ -27,7 +26,6 @@ def test_wmts():

@pytest.mark.network
@pytest.mark.skipif(not _OWSLIB_AVAILABLE, reason='OWSLib is unavailable.')
@cleanup
def test_wms_tight_layout():
ax = plt.axes(projection=ccrs.PlateCarree())
url = 'http://vmap0.tiles.osgeo.org/wms/vmap0'
Expand Down

0 comments on commit 7bf35d9

Please sign in to comment.