Skip to content

Commit

Permalink
Merge pull request #355 from astrofrog/fix-tests
Browse files Browse the repository at this point in the history
Fix compatibility with latest pytest-mpl version
  • Loading branch information
astrofrog committed Jul 29, 2017
2 parents 5c662f0 + 7552a3a commit 3a1e057
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ env:
# Note that we DO NOT use stable for numpy as there are no mpl 1.4.x
# builds available on conda for numpy 1.11
- NUMPY_VERSION=1.10
- ASTROPY_VERSION=stable
- ASTROPY_VERSION=1.3
- MATPLOTLIB_VERSION=1.5
- CONDA_DEPENDENCIES='nose pyqt matplotlib pillow pyregion'
- CONDA_CHANNELS='astropy-ci-extras astropy'
Expand Down Expand Up @@ -58,10 +58,10 @@ matrix:
env: NUMPY_VERSION=1.9 MATPLOTLIB_VERSION=1.4 SETUP_CMD='test --remote-data'
- python: 2.7
env: NUMPY_VERSION=1.8 MATPLOTLIB_VERSION=1.4 SETUP_CMD='test --remote-data'
CONDA_DEPENDENCIES='nose pyqt=4 matplotlib pillow'
CONDA_DEPENDENCIES='nose pyqt=4 matplotlib pillow pyregion'
- python: 2.7
env: NUMPY_VERSION=1.7 MATPLOTLIB_VERSION=1.4 SETUP_CMD='test --remote-data'
CONDA_DEPENDENCIES='nose pyqt=4 matplotlib pillow'
CONDA_DEPENDENCIES='nose pyqt=4 matplotlib pillow pyregion'

before_install:

Expand Down
18 changes: 9 additions & 9 deletions aplpy/tests/test_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class TestBasic(BaseImageTests):
def test_basic_image(self, generate):
f = FITSFigure(self.filename_2, figsize=(7, 5))
f.show_grayscale()
return f
return f._figure

@remote_data
@pytest.mark.mpl_image_compare(savefig_kwargs={'adjust_bbox': False}, baseline_dir=baseline_dir, tolerance=7.5)
Expand All @@ -60,7 +60,7 @@ def test_ticks_labels_options(self, generate):
f.ticks.set_xspacing(0.2)
f.ticks.set_yspacing(0.2)
f.ticks.set_minor_frequency(10)
return f
return f._figure

# Test for showing colorscale
@remote_data
Expand All @@ -73,7 +73,7 @@ def test_show_colorbar_scalebar_beam(self, generate):
f.add_scalebar(7.5)
f.add_beam(major=0.5, minor=0.2, angle=10.)
f.tick_labels.hide()
return f
return f._figure

# Test for overlaying shapes
@remote_data
Expand All @@ -95,7 +95,7 @@ def test_overlay_shapes(self, generate):
f.frame.set_linewidth(1) # points
f.frame.set_color('black')
f.axis_labels.hide()
return f
return f._figure

# Test for grid
@remote_data
Expand All @@ -114,7 +114,7 @@ def test_grid(self, generate):
f.grid.set_linestyle('solid')
f.grid.set_xspacing('tick')
f.grid.set_yspacing(3)
return f
return f._figure

# Test recenter
@remote_data
Expand All @@ -130,7 +130,7 @@ def test_recenter(self, generate):
f.recenter(266.5, -29.0, width=0.1, height=0.1)
f.axis_labels.set_xpad(20)
f.axis_labels.set_ypad(20)
return f
return f._figure

# Test overlaying contours
@remote_data
Expand All @@ -145,7 +145,7 @@ def test_contours(self, generate):

f.ticks.set_color('black')
f.show_contour(data, levels=np.linspace(1., 254., 10), filled=False)
return f
return f._figure

# Test cube slice
@remote_data
Expand All @@ -160,7 +160,7 @@ def test_cube_slice(self, generate):
f.grid.set_yspacing(0.01)
f.tick_labels.set_xformat('%g')
f.tick_labels.set_yformat('dd:mm:ss.ss')
return f
return f._figure

# Test for ds9 regions
@remote_data
Expand All @@ -176,4 +176,4 @@ def test_regions(self, generate):
f.axis_labels.hide()
f.tick_labels.hide()
f.ticks.hide()
return f
return f._figure
2 changes: 1 addition & 1 deletion aplpy/tests/test_rgb.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ def test_rgb(self, generate, tmpdir):

f.recenter(359.3, -72.1, radius=0.05)

return f
return f._figure
4 changes: 2 additions & 2 deletions aplpy/tests/test_vectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ def test_default(self, generate):
f = FITSFigure(IMAGE, figsize=(4, 4))
f.show_grayscale()
f.show_vectors(PDATA, ADATA, color='orange')
return f
return f._figure

@remote_data
@pytest.mark.mpl_image_compare(savefig_kwargs={'adjust_bbox': False}, baseline_dir=baseline_dir, tolerance=1.5)
def test_step_scale(self, generate):
f = FITSFigure(IMAGE, figsize=(4, 4))
f.show_grayscale()
f.show_vectors(PDATA, ADATA, step=2, scale=0.8, color='orange')
return f
return f._figure

0 comments on commit 3a1e057

Please sign in to comment.