Skip to content

Commit 3001ee1

Browse files
authored
Fix tests for upcoming matplotlib v2 (#1171)
1 parent 71d6a0e commit 3001ee1

File tree

3 files changed

+32
-4
lines changed

3 files changed

+32
-4
lines changed

.travis.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ matrix:
2828
env: CONDA_ENV=py35-dask-dev
2929
- python: 3.5
3030
env: CONDA_ENV=py35-pandas-dev
31+
- python: 3.5
32+
env: CONDA_ENV=py35-condaforge-rc
3133
allow_failures:
3234
- python: 2.7
3335
env: CONDA_ENV=py27-pydap
@@ -42,6 +44,8 @@ matrix:
4244
env: CONDA_ENV=py35-dask-dev
4345
- python: 3.5
4446
env: CONDA_ENV=py35-pandas-dev
47+
- python: 3.5
48+
env: CONDA_ENV=py35-condaforge-rc
4549

4650
before_install:
4751
- if [[ "$TRAVIS_PYTHON_VERSION" == "2.7" ]]; then
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: test_env
2+
channels:
3+
- conda-forge/label/rc
4+
- conda-forge
5+
dependencies:
6+
- python=3.5
7+
- cython
8+
- dask
9+
- distributed
10+
- h5py
11+
- matplotlib
12+
- netcdf4
13+
- pytest
14+
- numpy
15+
- pandas
16+
- seaborn
17+
- scipy
18+
- pip:
19+
- coveralls
20+
- pytest-cov
21+
- h5netcdf

xarray/test/test_plot.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,12 @@ def test_subplot_kws(self):
161161
g = d.plot(x='x', y='y', col='z', col_wrap=2, cmap='cool',
162162
subplot_kws=dict(axisbg='r'))
163163
for ax in g.axes.flat:
164-
self.assertEqual(ax.get_axis_bgcolor(), 'r')
164+
try:
165+
# mpl V2
166+
self.assertEqual(ax.get_facecolor()[0:3],
167+
mpl.colors.to_rgb('r'))
168+
except AttributeError:
169+
self.assertEqual(ax.get_axis_bgcolor(), 'r')
165170

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

11181123
def test_num_ticks(self):
1119-
nticks = 100
1124+
nticks = 99
11201125
maxticks = nticks + 1
11211126
self.g.map_dataarray(xplt.imshow, 'x', 'y')
11221127
self.g.set_ticks(max_xticks=nticks, max_yticks=nticks)
@@ -1203,5 +1208,3 @@ def test_default_labels(self):
12031208
# Top row should be labeled
12041209
for label, ax in zip(self.darray.coords['col'].values, g.axes[0, :]):
12051210
self.assertTrue(substring_in_axes(label, ax))
1206-
1207-

0 commit comments

Comments
 (0)