23
23
@pytest .mark .parametrize ('orientation' , ['portrait' , 'landscape' ])
24
24
@pytest .mark .parametrize ('format, use_log, rcParams' , [
25
25
('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 }),
30
29
('eps' , False , {}),
31
30
('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 }),
34
32
], ids = [
35
33
'ps' ,
36
- 'ps with distiller' ,
34
+ 'ps with distiller=ghostscript' ,
35
+ 'ps with distiller=xpdf' ,
37
36
'ps with usetex' ,
38
37
'eps' ,
39
38
'eps afm' ,
@@ -56,8 +55,16 @@ def test_savefig_to_stringio(format, use_log, rcParams, orientation,
56
55
if not mpl .rcParams ["text.usetex" ]:
57
56
title += " \N{MINUS SIGN} \N{EURO SIGN} "
58
57
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 ))
61
68
62
69
s_val = s_buf .getvalue ().encode ('ascii' )
63
70
b_val = b_buf .getvalue ()
0 commit comments