Skip to content

Commit

Permalink
CI: Remove warning raising after new matplotlib release (#31573)
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesdong1991 authored Feb 2, 2020
1 parent ac61a8a commit 36f7e22
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions pandas/tests/plotting/test_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import pandas._config.config as cf

from pandas.compat.numpy import np_datetime64_compat
import pandas.util._test_decorators as td

from pandas import Index, Period, Series, Timestamp, date_range
import pandas._testing as tm
Expand Down Expand Up @@ -59,16 +60,15 @@ def test_register_by_default(self):
call = [sys.executable, "-c", code]
assert subprocess.check_call(call) == 0

@td.skip_if_no("matplotlib", min_version="3.1.3")
def test_registering_no_warning(self):
plt = pytest.importorskip("matplotlib.pyplot")
s = Series(range(12), index=date_range("2017", periods=12))
_, ax = plt.subplots()

# Set to the "warn" state, in case this isn't the first test run
register_matplotlib_converters()
with tm.assert_produces_warning(DeprecationWarning, check_stacklevel=False):
# GH#30588 DeprecationWarning from 2D indexing
ax.plot(s.index, s.values)
ax.plot(s.index, s.values)

def test_pandas_plots_register(self):
pytest.importorskip("matplotlib.pyplot")
Expand All @@ -91,6 +91,7 @@ def test_matplotlib_formatters(self):
assert Timestamp not in units.registry
assert Timestamp in units.registry

@td.skip_if_no("matplotlib", min_version="3.1.3")
def test_option_no_warning(self):
pytest.importorskip("matplotlib.pyplot")
ctx = cf.option_context("plotting.matplotlib.register_converters", False)
Expand All @@ -100,15 +101,12 @@ def test_option_no_warning(self):

# Test without registering first, no warning
with ctx:
# GH#30588 DeprecationWarning from 2D indexing on Index
with tm.assert_produces_warning(DeprecationWarning, check_stacklevel=False):
ax.plot(s.index, s.values)
ax.plot(s.index, s.values)

# Now test with registering
register_matplotlib_converters()
with ctx:
with tm.assert_produces_warning(DeprecationWarning, check_stacklevel=False):
ax.plot(s.index, s.values)
ax.plot(s.index, s.values)

def test_registry_resets(self):
units = pytest.importorskip("matplotlib.units")
Expand Down

0 comments on commit 36f7e22

Please sign in to comment.