Skip to content

Commit

Permalink
TST: Patch Circle matplotlib failure
Browse files Browse the repository at this point in the history
  • Loading branch information
gfyoung committed May 3, 2017
1 parent 544f9b4 commit fbfa7c2
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 27 deletions.
4 changes: 2 additions & 2 deletions pandas/tests/plotting/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,12 @@
import pandas.plotting as plotting
from pandas.plotting._tools import _flatten


"""
This is a common base class used for various plotting tests
"""

tm._skip_module_if_no_mpl()


def _skip_if_no_scipy_gaussian_kde():
try:
Expand All @@ -41,7 +42,6 @@ def _ok_for_gaussian_kde(kind):
return True


@tm.mplskip
class TestPlotBase(tm.TestCase):

def setup_method(self, method):
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/plotting/test_boxplot_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

""" Test cases for .boxplot method """

tm._skip_module_if_no_mpl()


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


@tm.mplskip
class TestDataFramePlots(TestPlotBase):

@slow
Expand Down Expand Up @@ -165,7 +166,6 @@ def test_fontsize(self):
xlabelsize=16, ylabelsize=16)


@tm.mplskip
class TestDataFrameGroupByPlots(TestPlotBase):

@slow
Expand Down
3 changes: 2 additions & 1 deletion pandas/tests/plotting/test_datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
from pandas.tests.plotting.common import (TestPlotBase,
_skip_if_no_scipy_gaussian_kde)

tm._skip_module_if_no_mpl()


@tm.mplskip
class TestTSPlot(TestPlotBase):

def setup_method(self, method):
Expand Down
6 changes: 3 additions & 3 deletions pandas/tests/plotting/test_hist_method.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
from pandas.tests.plotting.common import (TestPlotBase, _check_plot_works)


@tm.mplskip
tm._skip_module_if_no_mpl()


class TestSeriesPlots(TestPlotBase):

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


@tm.mplskip
class TestDataFramePlots(TestPlotBase):

@slow
Expand Down Expand Up @@ -251,7 +252,6 @@ def test_tight_layout(self):
tm.close()


@tm.mplskip
class TestDataFrameGroupByPlots(TestPlotBase):

@slow
Expand Down
4 changes: 2 additions & 2 deletions pandas/tests/plotting/test_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
from pandas.tests.plotting.common import (TestPlotBase, _check_plot_works,
_ok_for_gaussian_kde)

tm._skip_module_if_no_mpl()


@tm.mplskip
class TestSeriesPlots(TestPlotBase):

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


@tm.mplskip
class TestDataFramePlots(TestPlotBase):

@slow
Expand Down
3 changes: 2 additions & 1 deletion pandas/tests/plotting/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@
_skip_if_no_scipy_gaussian_kde,
_ok_for_gaussian_kde)

tm._skip_module_if_no_mpl()


@tm.mplskip
class TestSeriesPlots(TestPlotBase):

def setup_method(self, method):
Expand Down
23 changes: 7 additions & 16 deletions pandas/util/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,26 +283,17 @@ def close(fignum=None):
_close(fignum)


def _skip_if_32bit():
def _skip_module_if_no_mpl():
import pytest
if is_platform_32bit():
pytest.skip("skipping for 32 bit")

mpl = pytest.importorskip("matplotlib")
mpl.use("Agg", warn=False)

def mplskip(cls):
"""Skip a TestCase instance if matplotlib isn't installed"""

@classmethod
def setup_class(cls):
try:
import matplotlib as mpl
mpl.use("Agg", warn=False)
except ImportError:
import pytest
pytest.skip("matplotlib not installed")

cls.setup_class = setup_class
return cls
def _skip_if_32bit():
import pytest
if is_platform_32bit():
pytest.skip("skipping for 32 bit")


def _skip_if_no_mpl():
Expand Down

0 comments on commit fbfa7c2

Please sign in to comment.