@@ -235,20 +235,28 @@ def thread_draw_work():
235235 raise exc_info[1].with_traceback(exc_info[2])
236236"""
237237
238-
239- @pytest .mark .parametrize ("backend" , _get_testable_interactive_backends ())
238+ _thread_safe_backends = _get_testable_interactive_backends ()
239+ # Known unsafe backends. Remove the xfails if they start to pass!
240+ if "wx" in _thread_safe_backends :
241+ _thread_safe_backends .remove ("wx" )
242+ _thread_safe_backends .append (
243+ pytest .param ("wx" , marks = pytest .mark .xfail (
244+ raises = subprocess .CalledProcessError , strict = True )))
245+ if "macosx" in _thread_safe_backends :
246+ _thread_safe_backends .remove ("macosx" )
247+ _thread_safe_backends .append (
248+ pytest .param ("macosx" , marks = pytest .mark .xfail (
249+ raises = subprocess .TimeoutExpired , strict = True )))
250+
251+
252+ @pytest .mark .parametrize ("backend" , _thread_safe_backends )
240253@pytest .mark .flaky (reruns = 3 )
241254def test_interactive_thread_safety (backend ):
242255 proc = subprocess .run (
243256 [sys .executable , "-c" , _thread_test_script ],
244257 env = {** os .environ , "MPLBACKEND" : backend , "SOURCE_DATE_EPOCH" : "0" },
245- timeout = _test_timeout ,
258+ timeout = _test_timeout , check = True ,
246259 stdout = subprocess .PIPE , universal_newlines = True )
247- if proc .returncode :
248- if backend == "wx" :
249- pytest .xfail ("Ignoring deprecated wx failure. Use wxagg." )
250- pytest .fail ("The subprocess returned with non-zero exit status "
251- f"{ proc .returncode } ." )
252260 assert proc .stdout .count ("CloseEvent" ) == 1
253261
254262
0 commit comments