@@ -78,21 +78,21 @@ def mpl_test_settings(request):
7878 style , = style_marker .args
7979
8080 matplotlib .testing .setup ()
81- if backend is not None :
82- # This import must come after setup() so it doesn't load the
83- # default backend prematurely.
84- import matplotlib .pyplot as plt
85- try :
86- plt .switch_backend (backend )
87- except ImportError as exc :
88- # Should only occur for the cairo backend tests, if neither
89- # pycairo nor cairocffi are installed.
90- if 'cairo' in backend .lower () or skip_on_importerror :
91- pytest .skip ("Failed to switch to backend {} ({})."
92- .format (backend , exc ))
93- else :
94- raise
9581 with cbook ._suppress_matplotlib_deprecation_warning ():
82+ if backend is not None :
83+ # This import must come after setup() so it doesn't load the
84+ # default backend prematurely.
85+ import matplotlib .pyplot as plt
86+ try :
87+ plt .switch_backend (backend )
88+ except ImportError as exc :
89+ # Should only occur for the cairo backend tests, if neither
90+ # pycairo nor cairocffi are installed.
91+ if 'cairo' in backend .lower () or skip_on_importerror :
92+ pytest .skip ("Failed to switch to backend {} ({})."
93+ .format (backend , exc ))
94+ else :
95+ raise
9696 matplotlib .style .use (style )
9797 try :
9898 yield
0 commit comments