Skip to content

Commit

Permalink
move some skips to function level
Browse files Browse the repository at this point in the history
  • Loading branch information
rcomer authored and greglucas committed Dec 5, 2023
1 parent 79ea7de commit 7294ac8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
8 changes: 4 additions & 4 deletions lib/cartopy/tests/mpl/test_caching.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@
from cartopy.tests.conftest import _HAS_PYKDTREE_OR_SCIPY


if not _HAS_PYKDTREE_OR_SCIPY:
pytest.skip('pykdtree or scipy is required', allow_module_level=True)
if _HAS_PYKDTREE_OR_SCIPY:
from cartopy.io.ogc_clients import _OWSLIB_AVAILABLE, WMTSRasterSource

from cartopy.io.ogc_clients import _OWSLIB_AVAILABLE, WMTSRasterSource
import cartopy.io.shapereader
from cartopy.mpl import _MPL_38
from cartopy.mpl.feature_artist import FeatureArtist
Expand Down Expand Up @@ -155,7 +154,8 @@ def test_contourf_transform_path_counting():

@pytest.mark.filterwarnings("ignore:TileMatrixLimits")
@pytest.mark.network
@pytest.mark.skipif(not _OWSLIB_AVAILABLE, reason='OWSLib is unavailable.')
@pytest.mark.skipif(not _HAS_PYKDTREE_OR_SCIPY or not _OWSLIB_AVAILABLE,
reason='OWSLib and at least one of pykdtree or scipy is required')
def test_wmts_tile_caching():
image_cache = WMTSRasterSource._shared_image_cache
image_cache.clear()
Expand Down
13 changes: 7 additions & 6 deletions lib/cartopy/tests/mpl/test_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@
from cartopy.tests.conftest import _HAS_PYKDTREE_OR_SCIPY


if not _HAS_PYKDTREE_OR_SCIPY:
pytest.skip('pykdtree or scipy is required', allow_module_level=True)

from cartopy.io.ogc_clients import _OWSLIB_AVAILABLE
if _HAS_PYKDTREE_OR_SCIPY:
from cartopy.io.ogc_clients import _OWSLIB_AVAILABLE


@pytest.mark.filterwarnings("ignore:Downloading")
Expand Down Expand Up @@ -49,6 +47,7 @@ def test_natural_earth_custom():
return ax.figure


@pytest.mark.skipif(not _HAS_PYKDTREE_OR_SCIPY, reason='pykdtree or scipy is required')
@pytest.mark.mpl_image_compare(filename='gshhs_coastlines.png', tolerance=0.95)
def test_gshhs():
ax = plt.axes(projection=ccrs.Mollweide())
Expand All @@ -64,7 +63,8 @@ def test_gshhs():


@pytest.mark.network
@pytest.mark.skipif(not _OWSLIB_AVAILABLE, reason='OWSLib is unavailable.')
@pytest.mark.skipif(not _HAS_PYKDTREE_OR_SCIPY or not _OWSLIB_AVAILABLE,
reason='OWSLib and at least one of pykdtree or scipy is required')
@pytest.mark.xfail(raises=ParseError,
reason="Bad XML returned from the URL")
@pytest.mark.mpl_image_compare(filename='wfs.png')
Expand All @@ -79,7 +79,8 @@ def test_wfs():


@pytest.mark.network
@pytest.mark.skipif(not _OWSLIB_AVAILABLE, reason='OWSLib is unavailable.')
@pytest.mark.skipif(not _HAS_PYKDTREE_OR_SCIPY or not _OWSLIB_AVAILABLE,
reason='OWSLib and at least one of pykdtree or scipy is required')
@pytest.mark.xfail(raises=ParseError,
reason="Bad XML returned from the URL")
@pytest.mark.mpl_image_compare(filename='wfs_france.png')
Expand Down
8 changes: 6 additions & 2 deletions lib/cartopy/tests/test_img_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@
from numpy.testing import assert_array_equal
import pytest

from cartopy.tests.conftest import (_HAS_PYKDTREE, _HAS_SCIPY, requires_pykdtree,
requires_scipy)
from cartopy.tests.conftest import (
_HAS_PYKDTREE,
_HAS_SCIPY,
requires_pykdtree,
requires_scipy,
)


if not (_HAS_PYKDTREE or _HAS_SCIPY):
Expand Down

0 comments on commit 7294ac8

Please sign in to comment.