Skip to content

Commit

Permalink
TST: xfail some tests for mpl 2.2 compat (pandas-dev#20033)
Browse files Browse the repository at this point in the history
  • Loading branch information
jreback authored Mar 7, 2018
1 parent 56939b4 commit 397e296
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pandas/tests/plotting/test_datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -1356,10 +1356,10 @@ def test_plot_outofbounds_datetime(self):
values = [datetime(1677, 1, 1, 12), datetime(1677, 1, 2, 12)]
ax.plot(values)

@td.xfail_if_mpl_2_2
@pytest.mark.skip(
is_platform_mac(),
"skip on mac for precision display issue on older mpl")
@pytest.mark.xfail(reason="suspect on mpl 2.2.2")
def test_format_timedelta_ticks_narrow(self):

if self.mpl_ge_2_0_0:
Expand All @@ -1381,10 +1381,10 @@ def test_format_timedelta_ticks_narrow(self):
for l, l_expected in zip(labels, expected_labels):
assert l.get_text() == l_expected

@td.xfail_if_mpl_2_2
@pytest.mark.skip(
is_platform_mac(),
"skip on mac for precision display issue on older mpl")
@pytest.mark.xfail(reason="suspect on mpl 2.2.2")
def test_format_timedelta_ticks_wide(self):

if self.mpl_ge_2_0_0:
Expand Down
1 change: 1 addition & 0 deletions pandas/tests/plotting/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -2461,6 +2461,7 @@ def test_errorbar_asymmetrical(self):

tm.close()

@td.xfail_if_mpl_2_2
def test_table(self):
df = DataFrame(np.random.rand(10, 3),
index=list(string.ascii_letters[:10]))
Expand Down
1 change: 1 addition & 0 deletions pandas/tests/plotting/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def test_bootstrap_plot(self):
@td.skip_if_no_mpl
class TestDataFramePlots(TestPlotBase):

@td.xfail_if_mpl_2_2
@td.skip_if_no_scipy
def test_scatter_matrix_axis(self):
scatter_matrix = plotting.scatter_matrix
Expand Down
1 change: 1 addition & 0 deletions pandas/tests/plotting/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -792,6 +792,7 @@ def test_errorbar_plot(self):
with pytest.raises((ValueError, TypeError)):
s.plot(yerr=s_err)

@td.xfail_if_mpl_2_2
def test_table(self):
_check_plot_works(self.series.plot, table=True)
_check_plot_works(self.series.plot, table=self.series)
Expand Down
13 changes: 13 additions & 0 deletions pandas/util/_test_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,17 @@ def _skip_if_mpl_1_5():
mod.use("Agg", warn=False)


def _skip_if_mpl_2_2():
mod = safe_import("matplotlib")

if mod:
v = mod.__version__
if LooseVersion(v) > LooseVersion('2.1.2'):
return True
else:
mod.use("Agg", warn=False)


def _skip_if_has_locale():
lang, _ = locale.getlocale()
if lang is not None:
Expand Down Expand Up @@ -151,6 +162,8 @@ def decorated_func(func):
reason="Missing matplotlib dependency")
skip_if_mpl_1_5 = pytest.mark.skipif(_skip_if_mpl_1_5(),
reason="matplotlib 1.5")
xfail_if_mpl_2_2 = pytest.mark.xfail(_skip_if_mpl_2_2(),
reason="matplotlib 2.2")
skip_if_32bit = pytest.mark.skipif(is_platform_32bit(),
reason="skipping for 32 bit")
skip_if_windows = pytest.mark.skipif(is_platform_windows(),
Expand Down

0 comments on commit 397e296

Please sign in to comment.