From 775c784ba0a0c1019f24a0e69d182d2c33549728 Mon Sep 17 00:00:00 2001 From: DanRyanIrish Date: Wed, 28 Mar 2018 17:44:08 -0400 Subject: [PATCH] Set matplotlib backend for Travis. --- .travis.yml | 8 ++++++++ ndcube/mixins/plotting.py | 2 +- ndcube/tests/test_plotting.py | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 284cfe99c..1806834a2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -54,6 +54,9 @@ matrix: include: + # Add a matplotlib backend for generating plots in tests. + - env: MPLBACKEND='Agg' + # Do a basic test. - os: linux stage: Initial tests @@ -99,6 +102,11 @@ 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 diff --git a/ndcube/mixins/plotting.py b/ndcube/mixins/plotting.py index ee72f9fe1..2470eed1f 100644 --- a/ndcube/mixins/plotting.py +++ b/ndcube/mixins/plotting.py @@ -150,7 +150,7 @@ def _plot_3D_cube(self, plot_axis_indices=None, axes_units=None, if plot_axis_indices is None: plot_axis_indices = [-1, -2] if axes_units is None: - axes_units = [None, None] + axes_units = [None, None] i = ImageAnimatorWCS(self.data, wcs=self.wcs, image_axes=plot_axis_indices, unit_x_axis=axes_units[0], unit_y_axis=axes_units[1], axis_ranges=axes_coordinates, **kwargs) diff --git a/ndcube/tests/test_plotting.py b/ndcube/tests/test_plotting.py index bdee098eb..1d44888d4 100644 --- a/ndcube/tests/test_plotting.py +++ b/ndcube/tests/test_plotting.py @@ -87,7 +87,7 @@ def test_cube_plot_1D(test_input, test_kwargs, expected_values): output_ylim = output.axes.get_ylim() assert output_ylim[0] <= expected_ylim[0] assert output_ylim[1] >= expected_ylim[1] - + @pytest.mark.parametrize("test_input, test_kwargs, expected_values", [ (cube[0], {},