Skip to content

Commit f6b40dd

Browse files
jrebackpandres
authored andcommitted
TST: xfail some tests for mpl 2.2 compat (pandas-dev#20033)
xref pandas-dev#20031
1 parent 84b36b3 commit f6b40dd

File tree

5 files changed

+18
-2
lines changed

5 files changed

+18
-2
lines changed

pandas/tests/plotting/test_datetimelike.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1356,10 +1356,10 @@ def test_plot_outofbounds_datetime(self):
13561356
values = [datetime(1677, 1, 1, 12), datetime(1677, 1, 2, 12)]
13571357
ax.plot(values)
13581358

1359+
@td.xfail_if_mpl_2_2
13591360
@pytest.mark.skip(
13601361
is_platform_mac(),
13611362
"skip on mac for precision display issue on older mpl")
1362-
@pytest.mark.xfail(reason="suspect on mpl 2.2.2")
13631363
def test_format_timedelta_ticks_narrow(self):
13641364

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

1384+
@td.xfail_if_mpl_2_2
13841385
@pytest.mark.skip(
13851386
is_platform_mac(),
13861387
"skip on mac for precision display issue on older mpl")
1387-
@pytest.mark.xfail(reason="suspect on mpl 2.2.2")
13881388
def test_format_timedelta_ticks_wide(self):
13891389

13901390
if self.mpl_ge_2_0_0:

pandas/tests/plotting/test_frame.py

+1
Original file line numberDiff line numberDiff line change
@@ -2461,6 +2461,7 @@ def test_errorbar_asymmetrical(self):
24612461

24622462
tm.close()
24632463

2464+
@td.xfail_if_mpl_2_2
24642465
def test_table(self):
24652466
df = DataFrame(np.random.rand(10, 3),
24662467
index=list(string.ascii_letters[:10]))

pandas/tests/plotting/test_misc.py

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def test_bootstrap_plot(self):
5252
@td.skip_if_no_mpl
5353
class TestDataFramePlots(TestPlotBase):
5454

55+
@td.xfail_if_mpl_2_2
5556
@td.skip_if_no_scipy
5657
def test_scatter_matrix_axis(self):
5758
scatter_matrix = plotting.scatter_matrix

pandas/tests/plotting/test_series.py

+1
Original file line numberDiff line numberDiff line change
@@ -792,6 +792,7 @@ def test_errorbar_plot(self):
792792
with pytest.raises((ValueError, TypeError)):
793793
s.plot(yerr=s_err)
794794

795+
@td.xfail_if_mpl_2_2
795796
def test_table(self):
796797
_check_plot_works(self.series.plot, table=True)
797798
_check_plot_works(self.series.plot, table=self.series)

pandas/util/_test_decorators.py

+13
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,17 @@ def _skip_if_mpl_1_5():
8989
mod.use("Agg", warn=False)
9090

9191

92+
def _skip_if_mpl_2_2():
93+
mod = safe_import("matplotlib")
94+
95+
if mod:
96+
v = mod.__version__
97+
if LooseVersion(v) > LooseVersion('2.1.2'):
98+
return True
99+
else:
100+
mod.use("Agg", warn=False)
101+
102+
92103
def _skip_if_has_locale():
93104
lang, _ = locale.getlocale()
94105
if lang is not None:
@@ -151,6 +162,8 @@ def decorated_func(func):
151162
reason="Missing matplotlib dependency")
152163
skip_if_mpl_1_5 = pytest.mark.skipif(_skip_if_mpl_1_5(),
153164
reason="matplotlib 1.5")
165+
xfail_if_mpl_2_2 = pytest.mark.xfail(_skip_if_mpl_2_2(),
166+
reason="matplotlib 2.2")
154167
skip_if_32bit = pytest.mark.skipif(is_platform_32bit(),
155168
reason="skipping for 32 bit")
156169
skip_if_windows = pytest.mark.skipif(is_platform_windows(),

0 commit comments

Comments
 (0)