Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI: Remove warning raising after new matplotlib release #31573

Merged
merged 16 commits into from
Feb 2, 2020
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