77import re
88
99import six
10- from nose .plugins .skip import SkipTest
1110
1211import matplotlib
1312import matplotlib .pyplot as plt
14- from matplotlib .testing .decorators import cleanup
13+ from matplotlib .testing .decorators import cleanup , knownfailureif
14+
15+
16+ needs_ghostscript = knownfailureif (
17+ matplotlib .checkdep_ghostscript ()[0 ] is None ,
18+ "This test needs a ghostscript installation" )
19+
20+
21+ needs_tex = knownfailureif (
22+ not matplotlib .checkdep_tex (),
23+ "This test needs a TeX installation" )
1524
1625
1726def _test_savefig_to_stringio (format = 'ps' ):
@@ -50,18 +59,15 @@ def test_savefig_to_stringio():
5059
5160
5261@cleanup
62+ @needs_ghostscript
5363def test_savefig_to_stringio_with_distiller ():
54- if not matplotlib .checkdep_ghostscript ():
55- raise SkipTest ("This test requires a GhostScript installation" )
5664 matplotlib .rcParams ['ps.usedistiller' ] = 'ghostscript'
5765 _test_savefig_to_stringio ()
5866
5967
6068@cleanup
69+ @needs_tex
6170def test_savefig_to_stringio_with_usetex ():
62- if not matplotlib .checkdep_tex ():
63- raise SkipTest ("This test requires a TeX installation" )
64-
6571 matplotlib .rcParams ['text.latex.unicode' ] = True
6672 matplotlib .rcParams ['text.usetex' ] = True
6773 _test_savefig_to_stringio ()
@@ -73,10 +79,8 @@ def test_savefig_to_stringio_eps():
7379
7480
7581@cleanup
82+ @needs_tex
7683def test_savefig_to_stringio_with_usetex_eps ():
77- if not matplotlib .checkdep_tex ():
78- raise SkipTest ("This test requires a TeX installation" )
79-
8084 matplotlib .rcParams ['text.latex.unicode' ] = True
8185 matplotlib .rcParams ['text.usetex' ] = True
8286 _test_savefig_to_stringio (format = 'eps' )
0 commit comments