13
13
import sys
14
14
from subprocess import check_output
15
15
16
+ import matplotlib
16
17
from matplotlib import pyplot as plt
17
18
18
19
19
- def _determinism_save (objects = 'mhi' , format = "pdf" ):
20
+ def _determinism_save (objects = 'mhi' , format = "pdf" , usetex = False ):
20
21
# save current value of SOURCE_DATE_EPOCH and set it
21
22
# to a constant value, so that time difference is not
22
23
# taken into account
23
24
sde = os .environ .pop ('SOURCE_DATE_EPOCH' , None )
24
25
os .environ ['SOURCE_DATE_EPOCH' ] = "946684800"
25
26
27
+ matplotlib .rcParams ['text.usetex' ] = usetex
28
+
26
29
fig = plt .figure ()
27
30
28
31
if 'm' in objects :
@@ -73,7 +76,7 @@ def _determinism_save(objects='mhi', format="pdf"):
73
76
os .environ ['SOURCE_DATE_EPOCH' ] = sde
74
77
75
78
76
- def _determinism_check (objects = 'mhi' , format = "pdf" , uid = "" ):
79
+ def _determinism_check (objects = 'mhi' , format = "pdf" , uid = "" , usetex = False ):
77
80
"""
78
81
Output three times the same graphs and checks that the outputs are exactly
79
82
the same.
@@ -98,8 +101,8 @@ def _determinism_check(objects='mhi', format="pdf", uid=""):
98
101
'matplotlib.use(%r); '
99
102
'from matplotlib.testing.determinism '
100
103
'import _determinism_save;'
101
- '_determinism_save(%r,%r)'
102
- % (format , objects , format )])
104
+ '_determinism_save(%r,%r,%r )'
105
+ % (format , objects , format , usetex )])
103
106
plots .append (result )
104
107
for p in plots [1 :]:
105
108
assert_equal (p , plots [0 ])
0 commit comments