@@ -119,14 +119,15 @@ def test_bold_font_output_with_none_fonttype():
119119 ax .set_title ('bold-title' , fontweight = 'bold' )
120120
121121
122- def _test_determinism (filename ):
122+ def _test_determinism_save (filename , usetex ):
123123 # This function is mostly copy&paste from "def test_visibility"
124124 # To require no GUI, we use Figure and FigureCanvasSVG
125125 # instead of plt.figure and fig.savefig
126126 from matplotlib .figure import Figure
127127 from matplotlib .backends .backend_svg import FigureCanvasSVG
128128 from matplotlib import rc
129129 rc ('svg' , hashsalt = 'asdf' )
130+ rc ('text' , usetex = usetex )
130131
131132 fig = Figure ()
132133 ax = fig .add_subplot (111 )
@@ -138,12 +139,14 @@ def _test_determinism(filename):
138139 a , b , c = ax .errorbar (x , y , yerr = yerr , fmt = 'ko' )
139140 for artist in b :
140141 artist .set_visible (False )
142+ ax .set_title ('A string $1+2+\sigma$' )
143+ ax .set_xlabel ('A string $1+2+\sigma$' )
144+ ax .set_ylabel ('A string $1+2+\sigma$' )
141145
142146 FigureCanvasSVG (fig ).print_svg (filename )
143147
144148
145- @cleanup
146- def test_determinism ():
149+ def _test_determinism (filename , usetex ):
147150 import os
148151 import sys
149152 from subprocess import check_call
@@ -154,15 +157,27 @@ def test_determinism():
154157 'import matplotlib; '
155158 'matplotlib.use("svg"); '
156159 'from matplotlib.tests.test_backend_svg '
157- 'import _test_determinism ;'
158- '_test_determinism("determinism.svg")' ])
159- with open ('determinism.svg' , 'rb' ) as fd :
160+ 'import _test_determinism_save ;'
161+ '_test_determinism_save(%r, %r)' % ( filename , usetex ) ])
162+ with open (filename , 'rb' ) as fd :
160163 plots .append (fd .read ())
161- os .unlink ('determinism.svg' )
164+ os .unlink (filename )
162165 for p in plots [1 :]:
163166 assert_equal (p , plots [0 ])
164167
165168
169+ @cleanup
170+ def test_determinism_notex ():
171+ # unique filename to allow for parallel testing
172+ _test_determinism ('determinism_notex.svg' , usetex = False )
173+
174+
175+ @cleanup
176+ def test_determinism_tex ():
177+ # unique filename to allow for parallel testing
178+ _test_determinism ('determinism_tex.svg' , usetex = True )
179+
180+
166181if __name__ == '__main__' :
167182 import nose
168183 nose .runmodule (argv = ['-s' , '--with-doctest' ], exit = False )
0 commit comments