2323@pytest .mark .parametrize ('orientation' , ['portrait' , 'landscape' ])
2424@pytest .mark .parametrize ('format, use_log, rcParams' , [
2525 ('ps' , False , {}),
26- pytest .param ('ps' , False , {'ps.usedistiller' : 'ghostscript' },
27- marks = needs_ghostscript ),
28- pytest .param ('ps' , False , {'text.usetex' : True },
29- marks = [needs_ghostscript , needs_usetex ]),
26+ ('ps' , False , {'ps.usedistiller' : 'ghostscript' }),
27+ ('ps' , False , {'ps.usedistiller' : 'xpdf' }),
28+ ('ps' , False , {'text.usetex' : True }),
3029 ('eps' , False , {}),
3130 ('eps' , True , {'ps.useafm' : True }),
32- pytest .param ('eps' , False , {'text.usetex' : True },
33- marks = [needs_ghostscript , needs_usetex ]),
31+ ('eps' , False , {'text.usetex' : True }),
3432], ids = [
3533 'ps' ,
36- 'ps with distiller' ,
34+ 'ps with distiller=ghostscript' ,
35+ 'ps with distiller=xpdf' ,
3736 'ps with usetex' ,
3837 'eps' ,
3938 'eps afm' ,
@@ -56,8 +55,16 @@ def test_savefig_to_stringio(format, use_log, rcParams, orientation,
5655 if not mpl .rcParams ["text.usetex" ]:
5756 title += " \N{MINUS SIGN} \N{EURO SIGN} "
5857 ax .set_title (title )
59- fig .savefig (s_buf , format = format , orientation = orientation )
60- fig .savefig (b_buf , format = format , orientation = orientation )
58+ allowable_exceptions = []
59+ if rcParams .get ("ps.usedistiller" ):
60+ allowable_exceptions .append (mpl .ExecutableNotFoundError )
61+ if rcParams .get ("text.usetex" ):
62+ allowable_exceptions .append (RuntimeError )
63+ try :
64+ fig .savefig (s_buf , format = format , orientation = orientation )
65+ fig .savefig (b_buf , format = format , orientation = orientation )
66+ except tuple (allowable_exceptions ) as exc :
67+ pytest .skip (str (exc ))
6168
6269 s_val = s_buf .getvalue ().encode ('ascii' )
6370 b_val = b_buf .getvalue ()
0 commit comments