diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py index 3864a39c274d..d6d44bcdb283 100644 --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -491,13 +491,15 @@ def test_subclass_clear_cla(): # Note, we cannot use mocking here as we want to be sure that the # superclass fallback does not recurse. - with pytest.warns(match='Overriding `Axes.cla`'): + with pytest.warns(PendingDeprecationWarning, + match='Overriding `Axes.cla`'): class ClaAxes(Axes): def cla(self): nonlocal called called = True - with pytest.warns(match='Overriding `Axes.cla`'): + with pytest.warns(PendingDeprecationWarning, + match='Overriding `Axes.cla`'): class ClaSuperAxes(Axes): def cla(self): nonlocal called diff --git a/lib/matplotlib/tests/test_colors.py b/lib/matplotlib/tests/test_colors.py index f0c23038e11a..6d618c1b847c 100644 --- a/lib/matplotlib/tests/test_colors.py +++ b/lib/matplotlib/tests/test_colors.py @@ -117,7 +117,7 @@ def test_double_register_builtin_cmap(): mpl.colormaps[name], name=name, force=True ) with pytest.raises(ValueError, match='A colormap named "viridis"'): - with pytest.warns(): + with pytest.warns(PendingDeprecationWarning): cm.register_cmap(name, mpl.colormaps[name]) with pytest.warns(UserWarning): # TODO is warning more than once! @@ -128,7 +128,7 @@ def test_unregister_builtin_cmap(): name = "viridis" match = f'cannot unregister {name!r} which is a builtin colormap.' with pytest.raises(ValueError, match=match): - with pytest.warns(): + with pytest.warns(PendingDeprecationWarning): cm.unregister_cmap(name)