@@ -34,8 +34,12 @@ def qt_core(request):
3434
3535@pytest .mark .parametrize ('backend' , [
3636 # Note: the value is irrelevant; the important part is the marker.
37- pytest .param ('Qt4Agg' , marks = pytest .mark .backend ('Qt4Agg' )),
38- pytest .param ('Qt5Agg' , marks = pytest .mark .backend ('Qt5Agg' )),
37+ pytest .param (
38+ 'Qt4Agg' ,
39+ marks = pytest .mark .backend ('Qt4Agg' , skip_on_importerror = True )),
40+ pytest .param (
41+ 'Qt5Agg' ,
42+ marks = pytest .mark .backend ('Qt5Agg' , skip_on_importerror = True )),
3943])
4044def test_fig_close (backend ):
4145 # save the state of Gcf.figs
@@ -53,7 +57,7 @@ def test_fig_close(backend):
5357 assert init_figs == Gcf .figs
5458
5559
56- @pytest .mark .backend ('Qt5Agg' )
60+ @pytest .mark .backend ('Qt5Agg' , skip_on_importerror = True )
5761def test_fig_signals (qt_core ):
5862 # Create a figure
5963 plt .figure ()
@@ -130,8 +134,12 @@ def CustomHandler(signum, frame):
130134)
131135@pytest .mark .parametrize ('backend' , [
132136 # Note: the value is irrelevant; the important part is the marker.
133- pytest .param ('Qt4Agg' , marks = pytest .mark .backend ('Qt4Agg' )),
134- pytest .param ('Qt5Agg' , marks = pytest .mark .backend ('Qt5Agg' )),
137+ pytest .param (
138+ 'Qt4Agg' ,
139+ marks = pytest .mark .backend ('Qt4Agg' , skip_on_importerror = True )),
140+ pytest .param (
141+ 'Qt5Agg' ,
142+ marks = pytest .mark .backend ('Qt5Agg' , skip_on_importerror = True )),
135143])
136144def test_correct_key (backend , qt_core , qt_key , qt_mods , answer ):
137145 """
@@ -157,7 +165,7 @@ def on_key_press(event):
157165 qt_canvas .keyPressEvent (_Event ())
158166
159167
160- @pytest .mark .backend ('Qt5Agg' )
168+ @pytest .mark .backend ('Qt5Agg' , skip_on_importerror = True )
161169def test_pixel_ratio_change ():
162170 """
163171 Make sure that if the pixel ratio changes, the figure dpi changes but the
@@ -229,7 +237,7 @@ def set_pixel_ratio(ratio):
229237 assert (fig .get_size_inches () == (5 , 2 )).all ()
230238
231239
232- @pytest .mark .backend ('Qt5Agg' )
240+ @pytest .mark .backend ('Qt5Agg' , skip_on_importerror = True )
233241def test_subplottool ():
234242 fig , ax = plt .subplots ()
235243 with mock .patch (
@@ -238,7 +246,7 @@ def test_subplottool():
238246 fig .canvas .manager .toolbar .configure_subplots ()
239247
240248
241- @pytest .mark .backend ('Qt5Agg' )
249+ @pytest .mark .backend ('Qt5Agg' , skip_on_importerror = True )
242250def test_figureoptions ():
243251 fig , ax = plt .subplots ()
244252 ax .plot ([1 , 2 ])
@@ -250,7 +258,7 @@ def test_figureoptions():
250258 fig .canvas .manager .toolbar .edit_parameters ()
251259
252260
253- @pytest .mark .backend ('Qt5Agg' )
261+ @pytest .mark .backend ('Qt5Agg' , skip_on_importerror = True )
254262def test_double_resize ():
255263 # Check that resizing a figure twice keeps the same window size
256264 fig , ax = plt .subplots ()
@@ -270,7 +278,7 @@ def test_double_resize():
270278 assert window .height () == old_height
271279
272280
273- @pytest .mark .backend (" Qt5Agg" )
281+ @pytest .mark .backend (' Qt5Agg' , skip_on_importerror = True )
274282def test_canvas_reinit ():
275283 from matplotlib .backends .backend_qt5agg import FigureCanvasQTAgg
276284
0 commit comments