Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 960e49e

Browse files
committed
Add exception class to pytest.warns calls
This is failing on current pytest.
1 parent 91093a2 commit 960e49e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/matplotlib/tests/test_axes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,13 +491,13 @@ def test_subclass_clear_cla():
491491
# Note, we cannot use mocking here as we want to be sure that the
492492
# superclass fallback does not recurse.
493493

494-
with pytest.warns(match='Overriding `Axes.cla`'):
494+
with pytest.warns(PendingDeprecationWarning, match='Overriding `Axes.cla`'):
495495
class ClaAxes(Axes):
496496
def cla(self):
497497
nonlocal called
498498
called = True
499499

500-
with pytest.warns(match='Overriding `Axes.cla`'):
500+
with pytest.warns(PendingDeprecationWarning, match='Overriding `Axes.cla`'):
501501
class ClaSuperAxes(Axes):
502502
def cla(self):
503503
nonlocal called

lib/matplotlib/tests/test_colors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def test_double_register_builtin_cmap():
117117
mpl.colormaps[name], name=name, force=True
118118
)
119119
with pytest.raises(ValueError, match='A colormap named "viridis"'):
120-
with pytest.warns():
120+
with pytest.warns(PendingDeprecationWarning):
121121
cm.register_cmap(name, mpl.colormaps[name])
122122
with pytest.warns(UserWarning):
123123
# TODO is warning more than once!
@@ -128,7 +128,7 @@ def test_unregister_builtin_cmap():
128128
name = "viridis"
129129
match = f'cannot unregister {name!r} which is a builtin colormap.'
130130
with pytest.raises(ValueError, match=match):
131-
with pytest.warns():
131+
with pytest.warns(PendingDeprecationWarning):
132132
cm.unregister_cmap(name)
133133

134134

0 commit comments

Comments
 (0)