@@ -50,16 +50,14 @@ def _get_testable_interactive_backends():
50
50
reason = "macosx backend fails on Azure"
51
51
elif 'qt5' in backend and not have_qt5 :
52
52
reason = "no usable Qt5 bindings"
53
+ marks = []
53
54
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 } " ))
58
57
elif backend .startswith ('wx' ) and sys .platform == 'darwin' :
59
58
# 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 )
63
61
backends .append (backend )
64
62
return backends
65
63
@@ -216,16 +214,19 @@ def _test_thread_impl():
216
214
217
215
_thread_safe_backends = _get_testable_interactive_backends ()
218
216
# 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 ))
229
230
230
231
231
232
@pytest .mark .parametrize ("backend" , _thread_safe_backends )
0 commit comments