File tree 2 files changed +26
-1
lines changed
2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -208,3 +208,15 @@ def test_pdf_savefig_when_color_is_none(tmpdir):
208
208
fig .savefig (str (expected_image ), format = 'eps' )
209
209
result = compare_images (str (actual_image ), str (expected_image ), 0 )
210
210
assert result is None
211
+
212
+
213
+ def test_failing_latex (tmpdir ):
214
+ """Test failing latex subprocess call"""
215
+ path = tmpdir .join ("tmpoutput.pdf" )
216
+
217
+ rcParams ['text.usetex' ] = True
218
+
219
+ # This failes with "Double subscript"
220
+ plt .xlabel ("$%f_2_2$" % np .random .random ())
221
+ with pytest .raises (RuntimeError ) as excinfo :
222
+ plt .savefig (path )
Original file line number Diff line number Diff line change 12
12
13
13
import matplotlib
14
14
import matplotlib .pyplot as plt
15
- from matplotlib import patheffects
15
+ from matplotlib import patheffects , rcParams
16
16
from matplotlib .testing .determinism import (_determinism_source_date_epoch ,
17
17
_determinism_check )
18
18
@@ -174,3 +174,16 @@ def test_determinism_all():
174
174
def test_determinism_all_tex ():
175
175
"""Test for reproducible PS/tex output"""
176
176
_determinism_check (format = "ps" , usetex = True )
177
+
178
+
179
+ @needs_tex
180
+ def test_failing_latex (tmpdir ):
181
+ """Test failing latex subprocess call"""
182
+ path = tmpdir .join ("tmpoutput.ps" )
183
+
184
+ rcParams ['text.usetex' ] = True
185
+
186
+ # This failes with "Double subscript"
187
+ plt .xlabel ("$%f_2_2$" % np .random .random ())
188
+ with pytest .raises (RuntimeError ) as excinfo :
189
+ plt .savefig (path )
You can’t perform that action at this time.
0 commit comments