MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / test_non_gui_warning

Function test_non_gui_warning

lib/matplotlib/tests/test_backend_bases.py:83–98  ·  view source on GitHub ↗
(monkeypatch)

Source from the content-addressed store, hash-verified

81
82@pytest.mark.backend('pdf')
83def test_non_gui_warning(monkeypatch):
84 plt.subplots()
85
86 monkeypatch.setenv("DISPLAY", ":999")
87
88 with pytest.warns(UserWarning) as rec:
89 plt.show()
90 assert len(rec) == 1
91 assert ('FigureCanvasPdf is non-interactive, and thus cannot be shown'
92 in str(rec[0].message))
93
94 with pytest.warns(UserWarning) as rec:
95 plt.gcf().show()
96 assert len(rec) == 1
97 assert ('FigureCanvasPdf is non-interactive, and thus cannot be shown'
98 in str(rec[0].message))
99
100
101def test_grab_clear():

Callers

nothing calls this directly

Calls 2

subplotsMethod · 0.45
showMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…