From a1c3db268e9acfb23d8a3f82849c728512f4e6ce Mon Sep 17 00:00:00 2001 From: David Stansby Date: Sat, 7 Oct 2017 08:58:46 -0400 Subject: [PATCH] Backport PR #9303: Don't use pytest.filterwarings, which needs pytest>=3.2. --- lib/matplotlib/tests/test_image.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/matplotlib/tests/test_image.py b/lib/matplotlib/tests/test_image.py index 68a22894ec7b..9f99fdc6ec8b 100644 --- a/lib/matplotlib/tests/test_image.py +++ b/lib/matplotlib/tests/test_image.py @@ -806,10 +806,12 @@ def test_imshow_flatfield(): colors.LogNorm, lambda: colors.SymLogNorm(1), lambda: colors.PowerNorm(1)]) -@pytest.mark.filterwarnings("ignore:Attempting to set identical left==right") def test_empty_imshow(make_norm): fig, ax = plt.subplots() - im = ax.imshow([[]], norm=make_norm()) + with warnings.catch_warnings(): + warnings.filterwarnings( + "ignore", "Attempting to set identical left==right") + im = ax.imshow([[]], norm=make_norm()) im.set_extent([-5, 5, -5, 5]) fig.canvas.draw()