Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit af4213e

Browse files
author
Alexis Bienvenüe
committed
Pass usetex setting to _determinism_save
1 parent 1786555 commit af4213e

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

lib/matplotlib/testing/determinism.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,19 @@
1313
import sys
1414
from subprocess import check_output
1515

16+
import matplotlib
1617
from 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])

lib/matplotlib/tests/test_backend_ps.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,7 @@ def test_determinism_all():
198198
@needs_ghostscript
199199
def test_determinism_all_tex():
200200
"""Test for reproducible PS/tex output"""
201-
matplotlib.rcParams['text.usetex'] = True
202-
_determinism_check(format="ps", uid="_tex")
201+
_determinism_check(format="ps", uid="_tex", usetex=True)
203202

204203

205204
if __name__ == '__main__':

0 commit comments

Comments
 (0)