Skip to content

Commit 7ec9853

Browse files
committed
TST: Patch Circle matplotlib failure
1 parent 544f9b4 commit 7ec9853

10 files changed

+32
-20
lines changed

pandas/tests/plotting/common.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,12 @@
1919
import pandas.plotting as plotting
2020
from pandas.plotting._tools import _flatten
2121

22-
2322
"""
2423
This is a common base class used for various plotting tests
2524
"""
2625

26+
tm._skip_module_if_no_mpl()
27+
2728

2829
def _skip_if_no_scipy_gaussian_kde():
2930
try:
@@ -41,7 +42,6 @@ def _ok_for_gaussian_kde(kind):
4142
return True
4243

4344

44-
@tm.mplskip
4545
class TestPlotBase(tm.TestCase):
4646

4747
def setup_method(self, method):

pandas/tests/plotting/test_boxplot_method.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
""" Test cases for .boxplot method """
2323

24+
tm._skip_module_if_no_mpl()
25+
2426

2527
def _skip_if_mpl_14_or_dev_boxplot():
2628
# GH 8382
@@ -31,7 +33,6 @@ def _skip_if_mpl_14_or_dev_boxplot():
3133
pytest.skip("Matplotlib Regression in 1.4 and current dev.")
3234

3335

34-
@tm.mplskip
3536
class TestDataFramePlots(TestPlotBase):
3637

3738
@slow
@@ -165,7 +166,6 @@ def test_fontsize(self):
165166
xlabelsize=16, ylabelsize=16)
166167

167168

168-
@tm.mplskip
169169
class TestDataFrameGroupByPlots(TestPlotBase):
170170

171171
@slow

pandas/tests/plotting/test_datetimelike.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@
2020
from pandas.tests.plotting.common import (TestPlotBase,
2121
_skip_if_no_scipy_gaussian_kde)
2222

23+
tm._skip_module_if_no_mpl()
24+
2325

24-
@tm.mplskip
2526
class TestTSPlot(TestPlotBase):
2627

2728
def setup_method(self, method):

pandas/tests/plotting/test_deprecated.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@
1818
pandas.tools.plotting
1919
"""
2020

21+
tm._skip_module_if_no_mpl()
22+
2123

22-
@tm.mplskip
2324
class TestDeprecatedNameSpace(TestPlotBase):
2425

2526
@slow

pandas/tests/plotting/test_frame.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@
2727
_skip_if_no_scipy_gaussian_kde,
2828
_ok_for_gaussian_kde)
2929

30+
tm._skip_module_if_no_mpl()
31+
3032

31-
@tm.mplskip
3233
class TestDataFramePlots(TestPlotBase):
3334

3435
def setup_method(self, method):

pandas/tests/plotting/test_groupby.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010

1111
from pandas.tests.plotting.common import TestPlotBase
1212

13+
tm._skip_module_if_no_mpl()
14+
1315

14-
@tm.mplskip
1516
class TestDataFrameGroupByPlots(TestPlotBase):
1617

1718
def test_series_groupby_plotting_nominally_works(self):

pandas/tests/plotting/test_hist_method.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
from pandas.tests.plotting.common import (TestPlotBase, _check_plot_works)
1616

1717

18-
@tm.mplskip
18+
tm._skip_module_if_no_mpl()
19+
20+
1921
class TestSeriesPlots(TestPlotBase):
2022

2123
def setup_method(self, method):
@@ -140,7 +142,6 @@ def test_plot_fails_when_ax_differs_from_figure(self):
140142
self.ts.hist(ax=ax1, figure=fig2)
141143

142144

143-
@tm.mplskip
144145
class TestDataFramePlots(TestPlotBase):
145146

146147
@slow
@@ -251,7 +252,6 @@ def test_tight_layout(self):
251252
tm.close()
252253

253254

254-
@tm.mplskip
255255
class TestDataFrameGroupByPlots(TestPlotBase):
256256

257257
@slow

pandas/tests/plotting/test_misc.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@
1717
from pandas.tests.plotting.common import (TestPlotBase, _check_plot_works,
1818
_ok_for_gaussian_kde)
1919

20+
tm._skip_module_if_no_mpl()
21+
2022

21-
@tm.mplskip
2223
class TestSeriesPlots(TestPlotBase):
2324

2425
def setup_method(self, method):
@@ -50,7 +51,6 @@ def test_bootstrap_plot(self):
5051
_check_plot_works(bootstrap_plot, series=self.ts, size=10)
5152

5253

53-
@tm.mplskip
5454
class TestDataFramePlots(TestPlotBase):
5555

5656
@slow

pandas/tests/plotting/test_series.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@
2222
_skip_if_no_scipy_gaussian_kde,
2323
_ok_for_gaussian_kde)
2424

25+
tm._skip_module_if_no_mpl()
26+
2527

26-
@tm.mplskip
2728
class TestSeriesPlots(TestPlotBase):
2829

2930
def setup_method(self, method):

pandas/util/testing.py

+13-6
Original file line numberDiff line numberDiff line change
@@ -283,12 +283,6 @@ def close(fignum=None):
283283
_close(fignum)
284284

285285

286-
def _skip_if_32bit():
287-
import pytest
288-
if is_platform_32bit():
289-
pytest.skip("skipping for 32 bit")
290-
291-
292286
def mplskip(cls):
293287
"""Skip a TestCase instance if matplotlib isn't installed"""
294288

@@ -305,6 +299,19 @@ def setup_class(cls):
305299
return cls
306300

307301

302+
def _skip_module_if_no_mpl():
303+
import pytest
304+
305+
mpl = pytest.importorskip("matplotlib")
306+
mpl.use("Agg", warn=False)
307+
308+
309+
def _skip_if_32bit():
310+
import pytest
311+
if is_platform_32bit():
312+
pytest.skip("skipping for 32 bit")
313+
314+
308315
def _skip_if_no_mpl():
309316
try:
310317
import matplotlib # noqa

0 commit comments

Comments
 (0)