diff --git a/lib/matplotlib/tests/test_backend_bases.py b/lib/matplotlib/tests/test_backend_bases.py index 189ccb940bf1..d3443c24e9b0 100644 --- a/lib/matplotlib/tests/test_backend_bases.py +++ b/lib/matplotlib/tests/test_backend_bases.py @@ -58,11 +58,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