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
25 changes: 21 additions & 4 deletions pandas/tests/plotting/test_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,16 @@ def test_registering_no_warning(self):

# 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

import matplotlib as mpl

version = mpl.__version__
if version > "3.1.2":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use LooseVersion

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can also just define a new mpl skip decorator and skip if < 3.1.2

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for your quick reply, changed, and let me know if this is what you meant @jreback

ax.plot(s.index, s.values)
else:
with tm.assert_produces_warning(DeprecationWarning, check_stacklevel=False):
# GH#30588 DeprecationWarning from 2D indexing
ax.plot(s.index, s.values)

def test_pandas_plots_register(self):
pytest.importorskip("matplotlib.pyplot")
Expand Down Expand Up @@ -98,10 +105,20 @@ def test_option_no_warning(self):
s = Series(range(12), index=date_range("2017", periods=12))
_, ax = plt.subplots()

import matplotlib as mpl

version = mpl.__version__

# 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):
if version > "3.1.2":
# GH#30588 DeprecationWarning from 2D indexing on Index
with tm.assert_produces_warning(
DeprecationWarning, check_stacklevel=False
):
ax.plot(s.index, s.values)
else:
# GH#30588 should be no warning after new release
ax.plot(s.index, s.values)

# Now test with registering
Expand Down