Skip to content
This repository has been archived by the owner on Jun 16, 2018. It is now read-only.

Commit

Permalink
Make sure that all images comparison tests are now marked with @remot…
Browse files Browse the repository at this point in the history
…e_data since the baseline directory is remote.
  • Loading branch information
astrofrog committed May 6, 2016
1 parent a45313c commit 6cb7d91
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
6 changes: 5 additions & 1 deletion wcsaxes/tests/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import matplotlib.pyplot as plt

from astropy.wcs import WCS
from astropy.tests.helper import pytest
from astropy.tests.helper import pytest, remote_data

from .. import WCSAxes
from .. import datasets
Expand Down Expand Up @@ -35,6 +35,7 @@ def update_spines(self):

class TestFrame(BaseImageTests):

@remote_data
@pytest.mark.mpl_image_compare(baseline_dir=baseline_dir, filename='custom_frame.png', tolerance=1.5)
def test_custom_frame(self):

Expand Down Expand Up @@ -74,6 +75,7 @@ def test_custom_frame(self):

return fig

@remote_data
@pytest.mark.mpl_image_compare(baseline_dir=baseline_dir, filename='update_clip_path_rectangular.png', tolerance=1.5)
def test_update_clip_path_rectangular(self, tmpdir):

Expand All @@ -95,6 +97,7 @@ def test_update_clip_path_rectangular(self, tmpdir):

return fig

@remote_data
@pytest.mark.mpl_image_compare(baseline_dir=baseline_dir, filename='update_clip_path_nonrectangular.png', tolerance=1.5)
def test_update_clip_path_nonrectangular(self, tmpdir):

Expand All @@ -117,6 +120,7 @@ def test_update_clip_path_nonrectangular(self, tmpdir):

return fig

@remote_data
@pytest.mark.mpl_image_compare(baseline_dir=baseline_dir, filename='update_clip_path_change_wcs.png', tolerance=1.5)
def test_update_clip_path_change_wcs(self, tmpdir):

Expand Down
22 changes: 17 additions & 5 deletions wcsaxes/tests/test_images.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import shutil
import tempfile

import numpy as np
import matplotlib.pyplot as plt
from matplotlib.testing.compare import compare_images
from matplotlib.patches import Circle

from astropy import units as u
from astropy.io import fits
from astropy.tests.helper import pytest
from astropy.tests.helper import remote_data
from astropy.tests.helper import pytest, remote_data
from astropy.wcs import WCS

from ..rc_utils import rc_context
Expand Down Expand Up @@ -46,6 +42,7 @@ def setup_class(cls):

class TestBasic(BaseImageTests):

@remote_data
@pytest.mark.mpl_image_compare(baseline_dir=baseline_dir, filename='image_plot.png', tolerance=1.5)
def test_image_plot(self):
# Test for plotting image and also setting values of ticks
Expand All @@ -56,6 +53,7 @@ def test_image_plot(self):
ax.coords[0].set_ticks([-0.30, 0., 0.20] * u.degree, size=5, width=1)
return fig

@remote_data
@remote_data
@pytest.mark.mpl_image_compare(baseline_dir=baseline_dir, filename='contour_overlay.png', tolerance=1.5)
def test_contour_overlay(self):
Expand All @@ -80,6 +78,7 @@ def test_contour_overlay(self):

return fig

@remote_data
@pytest.mark.mpl_image_compare(baseline_dir=baseline_dir, filename='overlay_features_image.png', tolerance=1.5)
def test_overlay_features_image(self):

Expand Down Expand Up @@ -113,6 +112,7 @@ def test_overlay_features_image(self):

return fig

@remote_data
@pytest.mark.mpl_image_compare(baseline_dir=baseline_dir, filename='curvlinear_grid_patches_image.png', tolerance=1.5)
def test_curvilinear_grid_patches_image(self):

Expand Down Expand Up @@ -144,6 +144,7 @@ def test_curvilinear_grid_patches_image(self):

return fig

@remote_data
@pytest.mark.mpl_image_compare(baseline_dir=baseline_dir, filename='cube_slice_image.png', tolerance=1.5)
def test_cube_slice_image(self):

Expand All @@ -169,6 +170,7 @@ def test_cube_slice_image(self):

return fig

@remote_data
@pytest.mark.mpl_image_compare(baseline_dir=baseline_dir, filename='cube_slice_image_lonlat.png', tolerance=1.5)
def test_cube_slice_image_lonlat(self):

Expand All @@ -188,6 +190,7 @@ def test_cube_slice_image_lonlat(self):

return fig

@remote_data
@pytest.mark.mpl_image_compare(baseline_dir=baseline_dir, filename='changed_axis_units.png', tolerance=1.5)
def test_changed_axis_units(self):
# Test to see if changing the units of axis works
Expand All @@ -205,6 +208,7 @@ def test_changed_axis_units(self):

return fig

@remote_data
@pytest.mark.mpl_image_compare(baseline_dir=baseline_dir, filename='minor_ticks_image.png', tolerance=1.5)
def test_minor_ticks(self):
# Test for drawing minor ticks
Expand All @@ -223,6 +227,7 @@ def test_minor_ticks(self):

return fig

@remote_data
@pytest.mark.mpl_image_compare(baseline_dir=baseline_dir, filename='ticks_labels.png', tolerance=1.5)
def test_ticks_labels(self):
fig = plt.figure(figsize=(6, 6))
Expand Down Expand Up @@ -250,6 +255,7 @@ def test_ticks_labels(self):

return fig

@remote_data
@pytest.mark.mpl_image_compare(baseline_dir=baseline_dir, filename='rcparams.png', tolerance=1.5)
def test_rcparams(self):
# Test default style (matplotlib.rcParams) for ticks and gridlines
Expand All @@ -271,6 +277,7 @@ def test_rcparams(self):
ax.coords[1].set_ticks(exclude_overlapping=True)
return fig

@remote_data
@pytest.mark.mpl_image_compare(baseline_dir=baseline_dir, filename='tick_angles.png', tolerance=1.5)
def test_tick_angles(self):
# Test that tick marks point in the correct direction, even when the
Expand All @@ -291,6 +298,7 @@ def test_tick_angles(self):
ax.coords['dec'].set_ticks(color='red', size=20)
return fig

@remote_data
@pytest.mark.mpl_image_compare(baseline_dir=baseline_dir, filename='tick_angles_non_square_axes.png', tolerance=1.5)
def test_tick_angles_non_square_axes(self):
# Test that tick marks point in the correct direction, even when the
Expand All @@ -312,6 +320,7 @@ def test_tick_angles_non_square_axes(self):
ax.coords['dec'].set_ticks(color='red', size=20)
return fig

@remote_data
@pytest.mark.mpl_image_compare(baseline_dir=baseline_dir, filename='set_coord_type.png', tolerance=1.5)
def test_set_coord_type(self):
# Test for setting coord_type
Expand All @@ -329,6 +338,7 @@ def test_set_coord_type(self):
ax.coords[1].set_ticks(exclude_overlapping=True)
return fig

@remote_data
@pytest.mark.mpl_image_compare(baseline_dir=baseline_dir, filename='test_ticks_regression_1.png', tolerance=1.5)
def test_ticks_regression(self):
# Regression test for a bug that caused ticks aligned exactly with a
Expand All @@ -351,6 +361,7 @@ def test_ticks_regression(self):
ax.coords[1].set_ticklabel_position('all')
return fig

@remote_data
@pytest.mark.mpl_image_compare(baseline_dir=baseline_dir, filename='test_axislabels_regression.png', savefig_kwargs={'bbox_inches': 'tight'}, tolerance=1.5)
def test_axislabels_regression(self):
# Regression test for a bug that meant that if tick labels were made
Expand All @@ -365,6 +376,7 @@ def test_axislabels_regression(self):
ax.coords[1].ticklabels.set_visible(False)
return fig

@remote_data
@pytest.mark.mpl_image_compare(baseline_dir=baseline_dir, savefig_kwargs={'bbox_inches': 'tight'},
tolerance=1.5)
def test_noncelestial_angular(self, tmpdir):
Expand Down
5 changes: 4 additions & 1 deletion wcsaxes/tests/test_transform_coord_meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import astropy
from astropy import units as u
from astropy.wcs import WCS
from astropy.tests.helper import pytest
from astropy.tests.helper import pytest, remote_data

from .. import WCSAxes
from .test_images import BaseImageTests
Expand Down Expand Up @@ -60,6 +60,7 @@ def inverted(self):

class TestTransformCoordMeta(BaseImageTests):

@remote_data
@pytest.mark.mpl_image_compare(baseline_dir=baseline_dir, filename='coords_overlay.png', tolerance=1.5)
def test_coords_overlay(self):

Expand Down Expand Up @@ -108,6 +109,7 @@ def test_coords_overlay(self):
return fig

@requires_astropy_10
@remote_data
@pytest.mark.mpl_image_compare(baseline_dir=baseline_dir, filename='coords_overlay_auto_coord_meta.png', tolerance=1.5)
def test_coords_overlay_auto_coord_meta(self):

Expand All @@ -130,6 +132,7 @@ def test_coords_overlay_auto_coord_meta(self):

return fig

@remote_data
@pytest.mark.mpl_image_compare(baseline_dir=baseline_dir, filename='direct_init.png', tolerance=1.5)
def test_direct_init(self):

Expand Down

0 comments on commit 6cb7d91

Please sign in to comment.