Skip to content

Commit

Permalink
TST: Skip test if matplotlib too old
Browse files Browse the repository at this point in the history
  • Loading branch information
pllim committed Mar 13, 2020
1 parent 045ec8f commit 4af12c8
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions astropy/visualization/wcsaxes/tests/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from astropy.visualization.wcsaxes.transforms import CurvedTransform

MATPLOTLIB_LT_21 = LooseVersion(matplotlib.__version__) < LooseVersion("2.1")
MATPLOTLIB_LT_22 = LooseVersion(matplotlib.__version__) < LooseVersion("2.2")

DATA = os.path.abspath(os.path.join(os.path.dirname(__file__), 'data'))

Expand Down Expand Up @@ -449,10 +450,13 @@ def test_time_wcs(time_spectral_wcs_2d):
plt.subplot(projection=time_spectral_wcs_2d)


@pytest.mark.skipif('MATPLOTLIB_LT_21')
@ignore_matplotlibrc
def test_simplify_labels_usetex(tmpdir):
"""Regression test for https://github.com/astropy/astropy/issues/8004."""

if MATPLOTLIB_LT_22 or not matplotlib.checkdep_usetex(True):
pytest.skip('Incompatible with old matplotlib or TeX is not available')

plt.rc('text', usetex=True)

header = {
Expand Down Expand Up @@ -480,7 +484,4 @@ def test_simplify_labels_usetex(tmpdir):
ax.coords[1].set_ticks(spacing=30 * u.deg)
ax.grid()

if not matplotlib.checkdep_usetex(True):
pytest.skip('TeX is not available')

fig.savefig(tmpdir / 'plot.png')

0 comments on commit 4af12c8

Please sign in to comment.