File tree 7 files changed +20
-27
lines changed
7 files changed +20
-27
lines changed Original file line number Diff line number Diff line change 19
19
import pandas .plotting as plotting
20
20
from pandas .plotting ._tools import _flatten
21
21
22
-
23
22
"""
24
23
This is a common base class used for various plotting tests
25
24
"""
26
25
26
+ tm ._skip_module_if_no_mpl ()
27
+
27
28
28
29
def _skip_if_no_scipy_gaussian_kde ():
29
30
try :
@@ -41,7 +42,6 @@ def _ok_for_gaussian_kde(kind):
41
42
return True
42
43
43
44
44
- @tm .mplskip
45
45
class TestPlotBase (tm .TestCase ):
46
46
47
47
def setup_method (self , method ):
Original file line number Diff line number Diff line change 21
21
22
22
""" Test cases for .boxplot method """
23
23
24
+ tm ._skip_module_if_no_mpl ()
25
+
24
26
25
27
def _skip_if_mpl_14_or_dev_boxplot ():
26
28
# GH 8382
@@ -31,7 +33,6 @@ def _skip_if_mpl_14_or_dev_boxplot():
31
33
pytest .skip ("Matplotlib Regression in 1.4 and current dev." )
32
34
33
35
34
- @tm .mplskip
35
36
class TestDataFramePlots (TestPlotBase ):
36
37
37
38
@slow
@@ -165,7 +166,6 @@ def test_fontsize(self):
165
166
xlabelsize = 16 , ylabelsize = 16 )
166
167
167
168
168
- @tm .mplskip
169
169
class TestDataFrameGroupByPlots (TestPlotBase ):
170
170
171
171
@slow
Original file line number Diff line number Diff line change 20
20
from pandas .tests .plotting .common import (TestPlotBase ,
21
21
_skip_if_no_scipy_gaussian_kde )
22
22
23
+ tm ._skip_module_if_no_mpl ()
24
+
23
25
24
- @tm .mplskip
25
26
class TestTSPlot (TestPlotBase ):
26
27
27
28
def setup_method (self , method ):
Original file line number Diff line number Diff line change 15
15
from pandas .tests .plotting .common import (TestPlotBase , _check_plot_works )
16
16
17
17
18
- @tm .mplskip
18
+ tm ._skip_module_if_no_mpl ()
19
+
20
+
19
21
class TestSeriesPlots (TestPlotBase ):
20
22
21
23
def setup_method (self , method ):
@@ -140,7 +142,6 @@ def test_plot_fails_when_ax_differs_from_figure(self):
140
142
self .ts .hist (ax = ax1 , figure = fig2 )
141
143
142
144
143
- @tm .mplskip
144
145
class TestDataFramePlots (TestPlotBase ):
145
146
146
147
@slow
@@ -251,7 +252,6 @@ def test_tight_layout(self):
251
252
tm .close ()
252
253
253
254
254
- @tm .mplskip
255
255
class TestDataFrameGroupByPlots (TestPlotBase ):
256
256
257
257
@slow
Original file line number Diff line number Diff line change 17
17
from pandas .tests .plotting .common import (TestPlotBase , _check_plot_works ,
18
18
_ok_for_gaussian_kde )
19
19
20
+ tm ._skip_module_if_no_mpl ()
21
+
20
22
21
- @tm .mplskip
22
23
class TestSeriesPlots (TestPlotBase ):
23
24
24
25
def setup_method (self , method ):
@@ -50,7 +51,6 @@ def test_bootstrap_plot(self):
50
51
_check_plot_works (bootstrap_plot , series = self .ts , size = 10 )
51
52
52
53
53
- @tm .mplskip
54
54
class TestDataFramePlots (TestPlotBase ):
55
55
56
56
@slow
Original file line number Diff line number Diff line change 22
22
_skip_if_no_scipy_gaussian_kde ,
23
23
_ok_for_gaussian_kde )
24
24
25
+ tm ._skip_module_if_no_mpl ()
26
+
25
27
26
- @tm .mplskip
27
28
class TestSeriesPlots (TestPlotBase ):
28
29
29
30
def setup_method (self , method ):
Original file line number Diff line number Diff line change @@ -283,26 +283,17 @@ def close(fignum=None):
283
283
_close (fignum )
284
284
285
285
286
- def _skip_if_32bit ():
286
+ def _skip_module_if_no_mpl ():
287
287
import pytest
288
- if is_platform_32bit ():
289
- pytest .skip ("skipping for 32 bit" )
290
288
289
+ mpl = pytest .importorskip ("matplotlib" )
290
+ mpl .use ("Agg" , warn = False )
291
291
292
- def mplskip (cls ):
293
- """Skip a TestCase instance if matplotlib isn't installed"""
294
292
295
- @classmethod
296
- def setup_class (cls ):
297
- try :
298
- import matplotlib as mpl
299
- mpl .use ("Agg" , warn = False )
300
- except ImportError :
301
- import pytest
302
- pytest .skip ("matplotlib not installed" )
303
-
304
- cls .setup_class = setup_class
305
- return cls
293
+ def _skip_if_32bit ():
294
+ import pytest
295
+ if is_platform_32bit ():
296
+ pytest .skip ("skipping for 32 bit" )
306
297
307
298
308
299
def _skip_if_no_mpl ():
You can’t perform that action at this time.
0 commit comments