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

Skip to content

Commit df61699

Browse files
authored
Merge pull request #18420 from anntzer/psundate
Always strip out date in postscript's test_savefig_to_stringio.
2 parents ab45bcd + b35fcd7 commit df61699

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

lib/matplotlib/tests/test_backend_ps.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,8 @@
3939
'eps afm',
4040
'eps with usetex'
4141
])
42-
def test_savefig_to_stringio(format, use_log, rcParams, orientation,
43-
monkeypatch):
42+
def test_savefig_to_stringio(format, use_log, rcParams, orientation):
4443
mpl.rcParams.update(rcParams)
45-
monkeypatch.setenv("SOURCE_DATE_EPOCH", "0") # For reproducibility.
4644

4745
fig, ax = plt.subplots()
4846

@@ -70,12 +68,11 @@ def test_savefig_to_stringio(format, use_log, rcParams, orientation,
7068
s_val = s_buf.getvalue().encode('ascii')
7169
b_val = b_buf.getvalue()
7270

73-
if rcParams.get("ps.usedistiller") or rcParams.get("text.usetex"):
74-
# Strip out CreationDate betcase ghostscript doesn't obey
75-
# SOURCE_DATE_EPOCH. Note that in usetex mode, we *always* call
76-
# gs_distill, even if ps.usedistiller is unset.
77-
s_val = re.sub(b"(?<=\n%%CreationDate: ).*", b"", s_val)
78-
b_val = re.sub(b"(?<=\n%%CreationDate: ).*", b"", b_val)
71+
# Strip out CreationDate: ghostscript and cairo don't obey
72+
# SOURCE_DATE_EPOCH, and that environment variable is already tested in
73+
# test_determinism.
74+
s_val = re.sub(b"(?<=\n%%CreationDate: ).*", b"", s_val)
75+
b_val = re.sub(b"(?<=\n%%CreationDate: ).*", b"", b_val)
7976

8077
assert s_val == b_val.replace(b'\r\n', b'\n')
8178

0 commit comments

Comments
 (0)