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

Skip to content

Reproducible PS/PDF output (master) #6597

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 31 commits into from Dec 9, 2016
Merged
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
c6a4660
To allow reproducible output:
Jun 16, 2016
4e477dc
Reproducible PDF output: sort TTF characters
Jun 18, 2016
946ae45
Reproducible PDF output: sort fonts
Jun 18, 2016
22f71a2
Tests for determinist PDF output:
Jun 18, 2016
ad660d7
Share determinism test code for PS and PDF output.
Jun 27, 2016
37c28b4
Reproducible PS/tex output.
Jun 27, 2016
2e1c773
Removes test_source_date_epoch_tex test, since this is ghostscript de…
Jun 27, 2016
541f97e
PEP8
Jun 27, 2016
2a6ebc8
Add what's new section
Jul 7, 2016
6ee8967
Add some insight when test_source_date_epoch fails.
Jul 8, 2016
a3185e6
Allow parallel execution of test_backend_ps:test_determinism_all_tex …
Jul 8, 2016
8f095f6
Use subprocess for _test_source_date_epoch, to allow parallel calls (…
Jul 8, 2016
c007f49
Change SOURCE_DATE_EPOCH test date, to use two-digits numbers for mon…
Jul 11, 2016
ecbdd55
PEP8
Jul 11, 2016
65ec88e
Warnings about possible unreproducibility issues
Jul 12, 2016
5b405cc
Doc rephrasing, thanks to jkseppan.
Jul 12, 2016
d10a21e
Use explicit date formatting for PS backend timestamp, instead of asc…
Jul 12, 2016
da55bb6
Revert to 2000-01-01 for the SOURCE_DATE_EPOCH test date.
Jul 12, 2016
c56dae7
Use standard date format for PS timestamp
Jul 13, 2016
995173d
Rename functions in determinism.py to remove `test' keyword, since th…
Oct 4, 2016
eef6b12
TST: Use standard I/O for determinism tests.
QuLogic Oct 7, 2016
fb529da
TST: Remove multiple nested imports.
QuLogic Oct 7, 2016
ebff832
TST: Fix compatibility with Python 2.
QuLogic Oct 8, 2016
f6301c2
Merge pull request #1 from QuLogic/reproducible-master
Oct 8, 2016
1786555
Adds __future__ imports to testing/determinism.py
Oct 9, 2016
af4213e
Pass usetex setting to _determinism_save
Oct 11, 2016
bf7387e
Skip test using ghostscript, since failing may be due to ghostscript …
Oct 11, 2016
2cdc577
Forgot to change one timestamp format in c56dae7c52af50ceaca33ba14717…
Oct 11, 2016
76bec02
Reuse UTC timezone from dates.py
Nov 2, 2016
bbab0c5
Removes now useless option uid for _determinism_check
Nov 3, 2016
1a5ada6
Typo
Nov 3, 2016
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
Prev Previous commit
Next Next commit
Use subprocess for _test_source_date_epoch, to allow parallel calls (…
…environment is shared between threads).
  • Loading branch information
Alexis Bienvenüe committed Jul 8, 2016
commit 8f095f613b51aa5ec563bfe28e8e97cf9187be0e
49 changes: 19 additions & 30 deletions lib/matplotlib/testing/determinism.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,34 +114,23 @@ def _test_source_date_epoch(format, string, keyword=b"CreationDate"):
a string to look at when searching for the timestamp in the document
(used in case the test fails).
"""
try:
# save current value of SOURCE_DATE_EPOCH
sde = os.environ.pop('SOURCE_DATE_EPOCH', None)
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1)
x = [1, 2, 3, 4, 5]
ax.plot(x, x)
os.environ['SOURCE_DATE_EPOCH'] = "946684800"
find_keyword = re.compile(b".*" + keyword + b".*")
with io.BytesIO() as output:
fig.savefig(output, format=format)
output.seek(0)
buff = output.read()
key = find_keyword.search(buff)
if key:
print(key.group())
else:
print("Timestamp keyword (%s) not found!" % keyword)
assert string in buff
os.environ.pop('SOURCE_DATE_EPOCH', None)
with io.BytesIO() as output:
fig.savefig(output, format=format)
output.seek(0)
buff = output.read()
assert string not in buff
finally:
# Restores SOURCE_DATE_EPOCH
if sde is None:
os.environ.pop('SOURCE_DATE_EPOCH', None)
import sys
from subprocess import check_call
filename = 'test_SDE_on.%s' % format
check_call([sys.executable, '-R', '-c',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that subprocess call can be replaced by function with switch_backend decorator

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the point is to use different random number generator seeds, not to segregate the backend changes.

'import matplotlib; '
'matplotlib.use(%r); '
'from matplotlib.testing.determinism '
'import _test_determinism_save;'
'_test_determinism_save(%r,%r,%r)'
% (format, filename, "", format)])
find_keyword = re.compile(b".*" + keyword + b".*")
with open(filename, 'rb') as fd:
buff = fd.read()
key = find_keyword.search(buff)
if key:
print(key.group())
else:
os.environ['SOURCE_DATE_EPOCH'] = sde
print("Timestamp keyword (%s) not found!" % keyword)
assert string in buff
os.unlink(filename)