Skip to content

Always strip out date in postscript's test_savefig_to_stringio. #18420

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 8, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions lib/matplotlib/tests/test_backend_ps.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,8 @@
'eps afm',
'eps with usetex'
])
def test_savefig_to_stringio(format, use_log, rcParams, orientation,
monkeypatch):
def test_savefig_to_stringio(format, use_log, rcParams, orientation):
mpl.rcParams.update(rcParams)
monkeypatch.setenv("SOURCE_DATE_EPOCH", "0") # For reproducibility.

fig, ax = plt.subplots()

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

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

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

Expand Down