Skip to content

Commit e9a0e55

Browse files
Debian Science Teamrebecca-palmer
Debian Science Team
authored andcommitted
Don't fail tests on harmless changes to dependencies
Ignore deprecation warnings added in Python 3.8, matplotlib 3.2, jedi 0.16/0.17 (one jedi deprecation appears to come from IPython because it uses stacklevel=2) Don't assert that matplotlib rejects shorthand hex colors, as from 3.2 it accepts them: https://matplotlib.org/users/prev_whats_new/whats_new_3.2.0.html#digit-and-4-digit-hex-colors Ignore change to date axis default range/ticks Author: Rebecca N. Palmer <[email protected]> Forwarded: no Gbp-Pq: Name ignore_matplotlib_warning.patch
1 parent e5389ea commit e9a0e55

File tree

3 files changed

+11
-20
lines changed

3 files changed

+11
-20
lines changed

pandas/tests/plotting/test_datetimelike.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,11 +1520,7 @@ def test_matplotlib_scatter_datetime64(self):
15201520
ax.scatter(x="time", y="y", data=df)
15211521
self.plt.draw()
15221522
label = ax.get_xticklabels()[0]
1523-
if self.mpl_ge_3_0_0:
1524-
expected = "2017-12-08"
1525-
else:
1526-
expected = "2017-12-12"
1527-
assert label.get_text() == expected
1523+
assert label.get_text() in ["2018-01-01","2017-12-08","2017-12-12"] # matplotlib version dependent
15281524

15291525

15301526
def _check_plot_works(f, freq=None, series=None, *args, **kwargs):

pandas/tests/plotting/test_frame.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1989,12 +1989,6 @@ def test_line_colors(self):
19891989
self._check_colors(ax.get_lines(), linecolors=custom_colors)
19901990
tm.close()
19911991

1992-
with pytest.raises(ValueError):
1993-
# Color contains shorthand hex value results in ValueError
1994-
custom_colors = ["#F00", "#00F", "#FF0", "#000", "#FFF"]
1995-
# Forced show plot
1996-
_check_plot_works(df.plot, color=custom_colors)
1997-
19981992
@pytest.mark.slow
19991993
def test_dont_modify_colors(self):
20001994
colors = ["r", "g", "b"]
@@ -2046,14 +2040,6 @@ def test_line_colors_and_styles_subplots(self):
20462040
self._check_colors(ax.get_lines(), linecolors=[c])
20472041
tm.close()
20482042

2049-
with pytest.raises(ValueError):
2050-
# Color contains shorthand hex value results in ValueError
2051-
custom_colors = ["#F00", "#00F", "#FF0", "#000", "#FFF"]
2052-
# Forced show plot
2053-
# _check_plot_works adds an ax so catch warning. see GH #13188
2054-
with tm.assert_produces_warning(UserWarning):
2055-
_check_plot_works(df.plot, color=custom_colors, subplots=True)
2056-
20572043
rgba_colors = [cm.jet(n) for n in np.linspace(0, 1, len(df))]
20582044
for cmap in ["jet", cm.jet]:
20592045
axes = df.plot(colormap=cmap, subplots=True)

pandas/util/testing.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
from typing import Union, cast
1616
import warnings
1717
import zipfile
18-
18+
try:
19+
from matplotlib.cbook import MatplotlibDeprecationWarning
20+
except ImportError:
21+
MatplotlibDeprecationWarning = None
1922
import numpy as np
2023
from numpy.random import rand, randn
2124

@@ -2695,6 +2698,12 @@ class for all warnings. To check that no warning is returned,
26952698
else:
26962699
if actual_warning.category==UserWarning and "Non-x86 system detected" in str(actual_warning.message) and not bool(re.match('i.?86|x86',platform.uname()[4])):
26972700
continue
2701+
if actual_warning.category==DeprecationWarning and "PY_SSIZE_T_CLEAN will be required for '#' formats" in str(actual_warning.message) and 'matplotlib' in actual_warning.filename:
2702+
continue
2703+
if actual_warning.category==MatplotlibDeprecationWarning and "deprecated in Matplotlib 3.2" in str(actual_warning.message) and 'matplotlib' in actual_warning.filename:
2704+
continue
2705+
if actual_warning.category==DeprecationWarning and ('jedi' in actual_warning.filename or 'IPython' in actual_warning.filename):
2706+
continue
26982707
extra_warnings.append(
26992708
(
27002709
actual_warning.category.__name__,

0 commit comments

Comments
 (0)