Skip to content

Commit

Permalink
Fix tests for upcoming matplotlib v2 (#1171)
Browse files Browse the repository at this point in the history
  • Loading branch information
fmaussion authored Jan 4, 2017
1 parent 71d6a0e commit 3001ee1
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ matrix:
env: CONDA_ENV=py35-dask-dev
- python: 3.5
env: CONDA_ENV=py35-pandas-dev
- python: 3.5
env: CONDA_ENV=py35-condaforge-rc
allow_failures:
- python: 2.7
env: CONDA_ENV=py27-pydap
Expand All @@ -42,6 +44,8 @@ matrix:
env: CONDA_ENV=py35-dask-dev
- python: 3.5
env: CONDA_ENV=py35-pandas-dev
- python: 3.5
env: CONDA_ENV=py35-condaforge-rc

before_install:
- if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then
Expand Down
21 changes: 21 additions & 0 deletions ci/requirements-py35-condaforge-rc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: test_env
channels:
- conda-forge/label/rc
- conda-forge
dependencies:
- python=3.5
- cython
- dask
- distributed
- h5py
- matplotlib
- netcdf4
- pytest
- numpy
- pandas
- seaborn
- scipy
- pip:
- coveralls
- pytest-cov
- h5netcdf
11 changes: 7 additions & 4 deletions xarray/test/test_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,12 @@ def test_subplot_kws(self):
g = d.plot(x='x', y='y', col='z', col_wrap=2, cmap='cool',
subplot_kws=dict(axisbg='r'))
for ax in g.axes.flat:
self.assertEqual(ax.get_axis_bgcolor(), 'r')
try:
# mpl V2
self.assertEqual(ax.get_facecolor()[0:3],
mpl.colors.to_rgb('r'))
except AttributeError:
self.assertEqual(ax.get_axis_bgcolor(), 'r')

def test_plot_size(self):
self.darray[:, 0, 0].plot(figsize=(13, 5))
Expand Down Expand Up @@ -1116,7 +1121,7 @@ def test_figure_size(self):
g = xplt.plot(self.darray, row=2, col='z', ax=plt.gca(), size=6)

def test_num_ticks(self):
nticks = 100
nticks = 99
maxticks = nticks + 1
self.g.map_dataarray(xplt.imshow, 'x', 'y')
self.g.set_ticks(max_xticks=nticks, max_yticks=nticks)
Expand Down Expand Up @@ -1203,5 +1208,3 @@ def test_default_labels(self):
# Top row should be labeled
for label, ax in zip(self.darray.coords['col'].values, g.axes[0, :]):
self.assertTrue(substring_in_axes(label, ax))


0 comments on commit 3001ee1

Please sign in to comment.