diff --git a/lib/matplotlib/tests/test_backend_bases.py b/lib/matplotlib/tests/test_backend_bases.py index 676686b7b1da..a6d6e57696ac 100644 --- a/lib/matplotlib/tests/test_backend_bases.py +++ b/lib/matplotlib/tests/test_backend_bases.py @@ -56,11 +56,11 @@ def test_get_default_filename(tmpdir): @pytest.mark.backend('pdf') -@pytest.mark.skipif('SYSTEM_TEAMFOUNDATIONCOLLECTIONURI' in os.environ, - reason="this test fails an azure for unknown reasons") -def test_non_gui_warning(): +def test_non_gui_warning(monkeypatch): plt.subplots() + monkeypatch.setitem(os.environ, "DISPLAY", ":999") + with pytest.warns(UserWarning) as rec: plt.show() assert len(rec) == 1