From f1bc93337cece36cb9a4959cb8018cca83d2bf37 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Sat, 3 Nov 2018 18:13:39 +0100 Subject: [PATCH] Fix test_non_gui_warning for Azure (and mplcairo). If on Linux and $DISPLAY is not set, then the non-gui warning is not emitted. We didn't notice that on Travis as $DISPLAY was indeed always set; but it's not on Azure. --- lib/matplotlib/tests/test_backend_bases.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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