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

Skip to content
Merged
Show file tree
Hide file tree
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
Rename functions in determinism.py to remove `test' keyword, since th…
…ese are not main testing functions.
  • Loading branch information
Alexis Bienvenüe committed Oct 4, 2016
commit 995173d6ef9a1dd0b1012c2729e177b89b9e9d3e
14 changes: 7 additions & 7 deletions lib/matplotlib/testing/determinism.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from matplotlib import pyplot as plt


def _test_determinism_save(filename, objects='mhi', format="pdf"):
def _determinism_save(filename, objects='mhi', format="pdf"):
# save current value of SOURCE_DATE_EPOCH and set it
# to a constant value, so that time difference is not
# taken into account
Expand Down Expand Up @@ -60,7 +60,7 @@ def _test_determinism_save(filename, objects='mhi', format="pdf"):
os.environ['SOURCE_DATE_EPOCH'] = sde


def _test_determinism(objects='mhi', format="pdf", uid=""):
def _determinism_check(objects='mhi', format="pdf", uid=""):
"""
Output three times the same graphs and checks that the outputs are exactly
the same.
Expand All @@ -87,8 +87,8 @@ def _test_determinism(objects='mhi', format="pdf", uid=""):
'import matplotlib; '
'matplotlib.use(%r); '
'from matplotlib.testing.determinism '
'import _test_determinism_save;'
'_test_determinism_save(%r,%r,%r)'
'import _determinism_save;'
'_determinism_save(%r,%r,%r)'
% (format, filename, objects, format)])
with open(filename, 'rb') as fd:
plots.append(fd.read())
Expand All @@ -97,7 +97,7 @@ def _test_determinism(objects='mhi', format="pdf", uid=""):
assert_equal(p, plots[0])


def _test_source_date_epoch(format, string, keyword=b"CreationDate"):
def _determinism_source_date_epoch(format, string, keyword=b"CreationDate"):
"""
Test SOURCE_DATE_EPOCH support. Output a document with the envionment
variable SOURCE_DATE_EPOCH set to 2000-01-01 00:00 UTC and check that the
Expand All @@ -121,8 +121,8 @@ def _test_source_date_epoch(format, string, keyword=b"CreationDate"):
'import matplotlib; '
'matplotlib.use(%r); '
'from matplotlib.testing.determinism '
'import _test_determinism_save;'
'_test_determinism_save(%r,%r,%r)'
'import _determinism_save;'
'_determinism_save(%r,%r,%r)'
% (format, filename, "", format)])
find_keyword = re.compile(b".*" + keyword + b".*")
with open(filename, 'rb') as fd:
Expand Down
16 changes: 8 additions & 8 deletions lib/matplotlib/tests/test_backend_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
from matplotlib import cm, rcParams
from matplotlib.backends.backend_pdf import PdfPages
from matplotlib import pyplot as plt
from matplotlib.testing.determinism import (_test_source_date_epoch,
_test_determinism)
from matplotlib.testing.determinism import (_determinism_source_date_epoch,
_determinism_check)
from matplotlib.testing.decorators import (image_comparison, knownfailureif,
cleanup)

Expand Down Expand Up @@ -114,37 +114,37 @@ def test_composite_image():
@cleanup
def test_source_date_epoch():
"""Test SOURCE_DATE_EPOCH support for PDF output"""
_test_source_date_epoch("pdf", b"/CreationDate (D:20000101000000Z)")
_determinism_source_date_epoch("pdf", b"/CreationDate (D:20000101000000Z)")


@cleanup
def test_determinism_plain():
"""Test for reproducible PDF output: simple figure"""
_test_determinism('', format="pdf")
_determinism_check('', format="pdf")


@cleanup
def test_determinism_images():
"""Test for reproducible PDF output: figure with different images"""
_test_determinism('i', format="pdf")
_determinism_check('i', format="pdf")


@cleanup
def test_determinism_hatches():
"""Test for reproducible PDF output: figure with different hatches"""
_test_determinism('h', format="pdf")
_determinism_check('h', format="pdf")


@cleanup
def test_determinism_markers():
"""Test for reproducible PDF output: figure with different markers"""
_test_determinism('m', format="pdf")
_determinism_check('m', format="pdf")


@cleanup
def test_determinism_all():
"""Test for reproducible PDF output"""
_test_determinism(format="pdf")
_determinism_check(format="pdf")


@image_comparison(baseline_images=['hatching_legend'],
Expand Down
11 changes: 6 additions & 5 deletions lib/matplotlib/tests/test_backend_ps.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
import matplotlib
import matplotlib.pyplot as plt
from matplotlib import patheffects
from matplotlib.testing.determinism import (_test_source_date_epoch,
_test_determinism)
from matplotlib.testing.determinism import (_determinism_source_date_epoch,
_determinism_check)
from matplotlib.testing.decorators import cleanup, knownfailureif


Expand Down Expand Up @@ -183,13 +183,14 @@ def test_source_date_epoch():
# because the produced timestamp comes from ghostscript:
# %%CreationDate: D:20000101000000Z00\'00\', and this could change
# with another ghostscript version.
_test_source_date_epoch("ps", b"%%CreationDate: Sat Jan 01 00:00:00 2000")
_determinism_source_date_epoch(
"ps", b"%%CreationDate: Sat Jan 01 00:00:00 2000")


@cleanup
def test_determinism_all():
"""Test for reproducible PS output"""
_test_determinism(format="ps")
_determinism_check(format="ps")


@cleanup
Expand All @@ -198,7 +199,7 @@ def test_determinism_all():
def test_determinism_all_tex():
"""Test for reproducible PS/tex output"""
matplotlib.rcParams['text.usetex'] = True
_test_determinism(format="ps", uid="_tex")
_determinism_check(format="ps", uid="_tex")


if __name__ == '__main__':
Expand Down