File tree Expand file tree Collapse file tree 7 files changed +20
-27
lines changed Expand file tree Collapse file tree 7 files changed +20
-27
lines changed Original file line number Diff line number Diff line change 1919import pandas .plotting as plotting
2020from pandas .plotting ._tools import _flatten
2121
22-
2322"""
2423This is a common base class used for various plotting tests
2524"""
2625
26+ tm ._skip_module_if_no_mpl ()
27+
2728
2829def _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
4545class TestPlotBase (tm .TestCase ):
4646
4747 def setup_method (self , method ):
Original file line number Diff line number Diff line change 2121
2222""" Test cases for .boxplot method """
2323
24+ tm ._skip_module_if_no_mpl ()
25+
2426
2527def _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
3536class TestDataFramePlots (TestPlotBase ):
3637
3738 @slow
@@ -165,7 +166,6 @@ def test_fontsize(self):
165166 xlabelsize = 16 , ylabelsize = 16 )
166167
167168
168- @tm .mplskip
169169class TestDataFrameGroupByPlots (TestPlotBase ):
170170
171171 @slow
Original file line number Diff line number Diff line change 2020from 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
2526class TestTSPlot (TestPlotBase ):
2627
2728 def setup_method (self , method ):
Original file line number Diff line number Diff line change 1515from pandas .tests .plotting .common import (TestPlotBase , _check_plot_works )
1616
1717
18- @tm .mplskip
18+ tm ._skip_module_if_no_mpl ()
19+
20+
1921class 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
144145class TestDataFramePlots (TestPlotBase ):
145146
146147 @slow
@@ -251,7 +252,6 @@ def test_tight_layout(self):
251252 tm .close ()
252253
253254
254- @tm .mplskip
255255class TestDataFrameGroupByPlots (TestPlotBase ):
256256
257257 @slow
Original file line number Diff line number Diff line change 1717from 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
2223class 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
5454class TestDataFramePlots (TestPlotBase ):
5555
5656 @slow
Original file line number Diff line number Diff line change 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
2728class TestSeriesPlots (TestPlotBase ):
2829
2930 def setup_method (self , method ):
Original file line number Diff line number Diff line change @@ -283,26 +283,17 @@ def close(fignum=None):
283283 _close (fignum )
284284
285285
286- def _skip_if_32bit ():
286+ def _skip_module_if_no_mpl ():
287287 import pytest
288- if is_platform_32bit ():
289- pytest .skip ("skipping for 32 bit" )
290288
289+ mpl = pytest .importorskip ("matplotlib" )
290+ mpl .use ("Agg" , warn = False )
291291
292- def mplskip (cls ):
293- """Skip a TestCase instance if matplotlib isn't installed"""
294292
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" )
306297
307298
308299def _skip_if_no_mpl ():
You can’t perform that action at this time.
0 commit comments