Skip to content

Commit

Permalink
Set matplotlib backend for testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
DanRyanIrish committed Mar 28, 2018
1 parent 47f8ec3 commit d629ec8
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
13 changes: 9 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ matrix:

include:

# Add a matploblib backend for generating plots in tests.
- env: MPLBACKEND='Agg'
# Add a matplotlib backend for generating plots in tests.
- env: MPLBACKEND='Agg'

# Do a basic test.
- os: linux
Expand Down Expand Up @@ -102,8 +102,13 @@ install:
- git clone git://github.com/astropy/ci-helpers.git
- source ci-helpers/travis/setup_conda.sh

before_script:
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- sleep 3 # give xvfb some time to start

script:
- $MAIN_CMD $SETUP_CMD
- $MAIN_CMD $SETUP_CMD

after_success:
- if [[ $SETUP_CMD = *"cov"* ]]; then pip install codecov; codecov; fi
- if [[ $SETUP_CMD = *"cov"* ]]; then pip install codecov; codecov; fi
4 changes: 2 additions & 2 deletions ndcube/mixins/sequence_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def plot(self, axes=None, plot_axis_indices=None,
Returns
-------
ax: `matplotlib.axes.Axes`, `ndcube.mixins.sequence_plotting.ImageAnimatorNDCubeSequence` or `ndcube.mixins.sequence_plotting.ImageAnimatorCubeLikeNDCubeSequence` # noqa
ax: `matplotlib.axes.Axes`, `ndcube.mixins.sequence_plotting.ImageAnimatorNDCubeSequence` or `ndcube.mixins.sequence_plotting.ImageAnimatorCubeLikeNDCubeSequence`
Axes or animation object depending on dimensionality of NDCubeSequence
"""
Expand Down Expand Up @@ -184,7 +184,7 @@ def plot_as_cube(self, axes=None, plot_axis_indices=None,
Returns
-------
ax: ax: `matplotlib.axes.Axes`, `ndcube.mixins.sequence_plotting.ImageAnimatorNDCubeSequence` or `ndcube.mixins.sequence_plotting.ImageAnimatorCubeLikeNDCubeSequence` # noqa
ax: ax: `matplotlib.axes.Axes`, `ndcube.mixins.sequence_plotting.ImageAnimatorNDCubeSequence` or `ndcube.mixins.sequence_plotting.ImageAnimatorCubeLikeNDCubeSequence`
Axes or animation object depending on dimensionality of NDCubeSequence
"""
Expand Down
3 changes: 3 additions & 0 deletions ndcube/tests/test_sequence_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
from ndcube.utils.wcs import WCS
import ndcube.mixins.sequence_plotting

# Set matplotlib display for testing
#matplotlib.use('Agg')

# sample data for tests
# TODO: use a fixture reading from a test file. file TBD.
data = np.array([[[1, 2, 3, 4], [2, 4, 5, 3], [0, -1, 2, 3]],
Expand Down

0 comments on commit d629ec8

Please sign in to comment.