@@ -111,6 +111,7 @@ def check_alt_backend(alt_backend):
111111timer.add_callback(FigureCanvasBase.key_press_event, fig.canvas, "q")
112112# Trigger quitting upon draw.
113113fig.canvas.mpl_connect("draw_event", lambda event: timer.start())
114+ fig.canvas.mpl_connect("close_event", print)
114115
115116plt.show()
116117"""
@@ -120,12 +121,14 @@ def check_alt_backend(alt_backend):
120121@pytest .mark .parametrize ("backend" , _get_testable_interactive_backends ())
121122@pytest .mark .flaky (reruns = 3 )
122123def test_interactive_backend (backend ):
123- proc = subprocess .run ([sys .executable , "-c" , _test_script ],
124- env = {** os .environ , "MPLBACKEND" : backend },
125- timeout = _test_timeout )
124+ proc = subprocess .run (
125+ [sys .executable , "-c" , _test_script ],
126+ env = {** os .environ , "MPLBACKEND" : backend }, timeout = _test_timeout ,
127+ stdout = subprocess .PIPE , universal_newlines = True )
126128 if proc .returncode :
127129 pytest .fail ("The subprocess returned with non-zero exit status "
128130 f"{ proc .returncode } ." )
131+ assert proc .stdout .count ("CloseEvent" ) == 1
129132
130133
131134@pytest .mark .skipif ('SYSTEM_TEAMFOUNDATIONCOLLECTIONURI' in os .environ ,
0 commit comments