| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
And document the standard keys in PdfPages. Also insert the matplotlib version in the default value of Producer as well as Creator, to retain a debugging clue in case the user overrides one of them.
Remove the metadata entries that depend on the date and the exact version.
Current coverage is 62.12% (diff: 100%)@@ master #7748 diff @@
==========================================
Files 174 174
Lines 56028 56028
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 34805 34806 +1
+ Misses 21223 21222 -1
Partials 0 0
|
Sorry, something went wrong.
| actual_fname = os.path.join(self.result_dir, baseline) + '.' + extension | ||
| fig.savefig(actual_fname, **self.savefig_kwargs) | ||
| kwargs = self.savefig_kwargs.copy() | ||
| if extension == 'pdf': |
There was a problem hiding this comment.
Doesn't this break the test of SOURCE_DATE_EPOCH ?
Sorry, something went wrong.
There was a problem hiding this comment.
No, that test starts a separate subprocess to write the output and doesn't use the image_comparison decorator at all.
Sorry, something went wrong.
There was a problem hiding this comment.
Ah, 🐑
Sorry, something went wrong.
|
the pgf tests roll their own image comparison code. attn @astrofrog this may need to be ported to pytest-mpl? |
Sorry, something went wrong.
|
|
||
|
|
||
| def set_reproducibility_for_testing(): | ||
| rcParams['svg.hashsalt'] = 'matplotlib' |
There was a problem hiding this comment.
This will also break, in a way, the determinism test.
Sorry, something went wrong.
There was a problem hiding this comment.
Can you explain in more detail? The _test_determinism_save function in test_backend_svg.py file also sets this rc parameter to a constant value.
Sorry, something went wrong.
There was a problem hiding this comment.
Probably along the same lines as @tacaswell; I was thinking it wouldn't fail if svg.hashsalt was broken. However, I see this test doesn't use the decorator anyway, so it is likely to still fail correctly.
Sorry, something went wrong.
There is a cache of png files keyed by the MD5 hashes of corresponding svg and pdf files, which helps reduce test suite running times for svg and pdf files that stay exactly the same from one run to the next. This patch enables caching of test results, not only expected results, which is only useful if the tests are mostly deterministic (see matplotlib#7748). It adds reporting of cache misses, which can be helpful in getting tests to stay deterministic, and expiration since the test results are going to change more often than the expected results.
There is a cache of png files keyed by the MD5 hashes of corresponding svg and pdf files, which helps reduce test suite running times for svg and pdf files that stay exactly the same from one run to the next. This patch enables caching of test results, not only expected results, which is only useful if the tests are mostly deterministic (see matplotlib#7748). It adds reporting of cache misses, which can be helpful in getting tests to stay deterministic, and expiration since the test results are going to change more often than the expected results.
There was a problem hiding this comment.
Some minor corrections, but otherwise fine.
Sorry, something went wrong.
| add sources of nondeterminism outside the control of matplotlib. | ||
|
|
||
| For SVG output, the ``svg.hashsalt`` rc parameter has been added in an | ||
| earlier release. In can be used to change some random id values in the |
There was a problem hiding this comment.
In -> It
Sorry, something went wrong.
| For SVG output, the ``svg.hashsalt`` rc parameter has been added in an | ||
| earlier release. In can be used to change some random id values in the | ||
| output to be deterministic, at the cost that including multiple such | ||
| svg files in one document can lead to collisions. |
There was a problem hiding this comment.
svg -> SVG
Sorry, something went wrong.
| output to be deterministic, at the cost that including multiple such | ||
| svg files in one document can lead to collisions. | ||
|
|
||
| These features are now enabled in the tests for the pdf and svg |
There was a problem hiding this comment.
pdf -> PDF
svg -> SVG
Sorry, something went wrong.
| the timestamp value in the PS and PDF outputs. See | ||
| https://reproducible-builds.org/specs/source-date-epoch/ | ||
|
|
||
| Alternatively, calling ``savefig`` with ``metadata={creationDate=None}`` |
There was a problem hiding this comment.
This dict literal is a bit broken; should be dict(creationDate=None) or {'creationDate': None}.
Sorry, something went wrong.
| self.infoDict = { | ||
| 'Creator': 'matplotlib %s, http://matplotlib.org' % __version__, | ||
| 'Producer': 'matplotlib pdf backend%s' % revision, | ||
| 'Producer': 'matplotlib pdf backend %s' % __version__, |
There was a problem hiding this comment.
Do we even need the version here? It's in the Creator tag.
Sorry, something went wrong.
There was a problem hiding this comment.
I thought including the version in both would help with debugging when the user has overridden just one of these. If you use Matplotlib as a component of some larger application, you might want to override Creator and leave Producer pointing to the PDF backend.
Sorry, something went wrong.
There was a problem hiding this comment.
Fair enough.
Sorry, something went wrong.
| add sources of nondeterminism outside the control of matplotlib. | ||
|
|
||
| For SVG output, the ``svg.hashsalt`` rc parameter has been added in an | ||
| earlier release. It can be used to change some random id values in the |
There was a problem hiding this comment.
I don't understand the following sentence:
"It can be used to change some random id values in the output to be deterministic, at the cost that including multiple such SVG files in one document can lead to collisions."
Isn't there an grammar problem?
Sorry, something went wrong.
There was a problem hiding this comment.
I'll try to rephrase.
Sorry, something went wrong.
|
Thanks! This looks good to me. |
Sorry, something went wrong.
| SVG files in one document can lead to collisions. | ||
| earlier release. This parameter changes some random identifiers in the | ||
| SVG file to be deterministic. The downside of this setting is that if | ||
| more than one file is generated using with deterministic identifiers |
There was a problem hiding this comment.
using with -> using.
Sorry, something went wrong.
There is a cache of png files keyed by the MD5 hashes of corresponding svg and pdf files, which helps reduce test suite running times for svg and pdf files that stay exactly the same from one run to the next. This patch enables caching of test results, not only expected results, which is only useful if the tests are mostly deterministic (see matplotlib#7748). It adds reporting of cache misses, which can be helpful in getting tests to stay deterministic, and expiration since the test results are going to change more often than the expected results.
There is a cache of png files keyed by the MD5 hashes of corresponding svg and pdf files, which helps reduce test suite running times for svg and pdf files that stay exactly the same from one run to the next. This patch enables caching of test results, not only expected results, which is only useful if the tests are mostly deterministic (see matplotlib#7748). It adds reporting of cache misses, which can be helpful in getting tests to stay deterministic, and expiration since the test results are going to change more often than the expected results.
There is a cache of png files keyed by the MD5 hashes of corresponding svg and pdf files, which helps reduce test suite running times for svg and pdf files that stay exactly the same from one run to the next. This patch enables caching of test results, not only expected results, which is only useful if the tests are mostly deterministic (see matplotlib#7748). It adds reporting of cache misses, which can be helpful in getting tests to stay deterministic, and expiration since the test results are going to change more often than the expected results.
There is a cache of png files keyed by the MD5 hashes of corresponding svg and pdf files, which helps reduce test suite running times for svg and pdf files that stay exactly the same from one run to the next. This patch enables caching of test results, not only expected results, which is only useful if the tests are mostly deterministic (see matplotlib#7748). It adds reporting of cache misses, which can be helpful in getting tests to stay deterministic, and expiration since the test results are going to change more often than the expected results.
There is a cache of png files keyed by the MD5 hashes of corresponding svg and pdf files, which helps reduce test suite running times for svg and pdf files that stay exactly the same from one run to the next. This patch enables caching of test results, not only expected results, which is only useful if the tests are mostly deterministic (see matplotlib#7748). It adds reporting of cache misses, which can be helpful in getting tests to stay deterministic, and expiration since the test results are going to change more often than the expected results.
| Back | FazBrowse Home | New Git URL |
There has been plenty of work (at least #4434, #5671, #5766, #6597) to make it possible to have deterministic svg and pdf output, or at least closer to deterministic than before. This change adds one related feature: callers can remove the bits of pdf metadata that contain the date and matplotlib version, so that new releases don't necessarily change the result of every test. Furthermore, this change enables all the optional pdf and svg determinism features in tests.
I am developing some improvements to test-result caching on another branch, and in my tests only the following test files still change from run to run after this patch (although in my environment I get KNOWNFAIL=27, SKIP=8 so some more are possible):