@@ -50,16 +50,14 @@ def _get_testable_interactive_backends():
5050 reason = "macosx backend fails on Azure"
5151 elif 'qt5' in backend and not have_qt5 :
5252 reason = "no usable Qt5 bindings"
53+ marks = []
5354 if reason :
54- backend = pytest .param (
55- backend ,
56- marks = pytest .mark .skip (
57- reason = f"Skipping { backend } because { reason } " ))
55+ marks .append (pytest .mark .skip (
56+ reason = f"Skipping { backend } because { reason } " ))
5857 elif backend .startswith ('wx' ) and sys .platform == 'darwin' :
5958 # ignore on OSX because that's currently broken (github #16849)
60- backend = pytest .param (
61- backend ,
62- marks = pytest .mark .xfail (reason = 'github #16849' ))
59+ marks .append (pytest .mark .xfail (reason = 'github #16849' ))
60+ backend = pytest .param (backend , marks = marks )
6361 backends .append (backend )
6462 return backends
6563
@@ -216,16 +214,19 @@ def _test_thread_impl():
216214
217215_thread_safe_backends = _get_testable_interactive_backends ()
218216# Known unsafe backends. Remove the xfails if they start to pass!
219- if "wx" in _thread_safe_backends :
220- _thread_safe_backends .remove ("wx" )
221- _thread_safe_backends .append (
222- pytest .param ("wx" , marks = pytest .mark .xfail (
223- raises = subprocess .CalledProcessError )))
224- if "macosx" in _thread_safe_backends :
225- _thread_safe_backends .remove ("macosx" )
226- _thread_safe_backends .append (
227- pytest .param ("macosx" , marks = pytest .mark .xfail (
228- raises = subprocess .TimeoutExpired , strict = True )))
217+ for param in _thread_safe_backends :
218+ backend = param .values [0 ]
219+ if "cairo" in backend :
220+ # Cairo backends save a cairo_t on the graphics context, and sharing
221+ # these is not threadsafe.
222+ param .marks .append (
223+ pytest .mark .xfail (raises = subprocess .CalledProcessError ))
224+ elif backend == "wx" :
225+ param .marks .append (
226+ pytest .mark .xfail (raises = subprocess .CalledProcessError ))
227+ elif backend == "macosx" :
228+ param .marks .append (
229+ pytest .mark .xfail (raises = subprocess .TimeoutExpired , strict = True ))
229230
230231
231232@pytest .mark .parametrize ("backend" , _thread_safe_backends )
0 commit comments