1313import sys
1414from subprocess import check_output
1515
16+ import matplotlib
1617from matplotlib import pyplot as plt
1718
1819
19- def _determinism_save (objects = 'mhi' , format = "pdf" ):
20+ def _determinism_save (objects = 'mhi' , format = "pdf" , usetex = False ):
2021 # save current value of SOURCE_DATE_EPOCH and set it
2122 # to a constant value, so that time difference is not
2223 # taken into account
2324 sde = os .environ .pop ('SOURCE_DATE_EPOCH' , None )
2425 os .environ ['SOURCE_DATE_EPOCH' ] = "946684800"
2526
27+ matplotlib .rcParams ['text.usetex' ] = usetex
28+
2629 fig = plt .figure ()
2730
2831 if 'm' in objects :
@@ -73,7 +76,7 @@ def _determinism_save(objects='mhi', format="pdf"):
7376 os .environ ['SOURCE_DATE_EPOCH' ] = sde
7477
7578
76- def _determinism_check (objects = 'mhi' , format = "pdf" , uid = "" ):
79+ def _determinism_check (objects = 'mhi' , format = "pdf" , uid = "" , usetex = False ):
7780 """
7881 Output three times the same graphs and checks that the outputs are exactly
7982 the same.
@@ -98,8 +101,8 @@ def _determinism_check(objects='mhi', format="pdf", uid=""):
98101 'matplotlib.use(%r); '
99102 'from matplotlib.testing.determinism '
100103 'import _determinism_save;'
101- '_determinism_save(%r,%r)'
102- % (format , objects , format )])
104+ '_determinism_save(%r,%r,%r )'
105+ % (format , objects , format , usetex )])
103106 plots .append (result )
104107 for p in plots [1 :]:
105108 assert_equal (p , plots [0 ])
0 commit comments