Repository navigation
Switch to using hash-based figure comparison - #13596
Conversation
|
👋 Thank you for your draft pull request! Do you know that you can use |
1206659 to
066cc55
Compare
066cc55 to
0e88c73
Compare
bsipocz
left a comment
There was a problem hiding this comment.
I suppose that the original argument against the hash-based approach is not relevant anymore, namely that it was very sensitive to non-important tiny differences that fit within the tolerance range? If that's the case, then this PR indeed provides a huge improvement of the status quo.
|
RTD warning needs fixing: |
|
@bsipocz indeed we actually set tolerance=0 now for all our image tests so we were being ultra strict anyway. |
Co-authored-by: P. L. Lim <[email protected]>
|
This is a bit of an aside but:
It still is, these hashes are still cryptographic hashes of the whole png file, so one byte of difference and the test fails. However, this issue is mitigated by a few key things:
|
…d versions of Matplotlib have deprecation warnings related to distutils
| # For coverage, we need to pass extra options to the C compiler | ||
| cov: CFLAGS = --coverage -fno-inline-functions -O0 | ||
| image: MPLFLAGS = --mpl | ||
| image: MPLFLAGS = -m "mpl_image_compare" --mpl --mpl-generate-summary=html --mpl-results-path={toxinidir}/results --mpl-hash-library={toxinidir}/astropy/tests/figures/{envname}.json --mpl-baseline-path=http://data.astropy.org/testing/astropy/figures/{envname}/ --remote-data=astropy -W ignore::DeprecationWarning |
There was a problem hiding this comment.
Why do we have the old data repo here and not the new one? If there aren't any figures to compare it against, it will still work.
|
I will need to backport this otherwise we won't be able to backport bug fixes for WCSAxes |
|
@meeseeksdev backport to v5.1.x |
|
@meeseeksdev backport to v5.0.x |
…596-on-v5.1.x Backport PR #13596 on branch v5.1.x (Switch to using hash-based figure comparison)
…596-on-v5.0.x Backport PR #13596 on branch v5.0.x (Switch to using hash-based figure comparison)
This switches the figure testing to use hash-based figure comparison, as described here and as done in sunpy. The idea is that we keep the latest expected hashes for each figure and tox environment, and if a figure test fails we can get a nice summary page here in the PR and see the difference and choose whether the changes make sense - if they do we just update the hash. Once the PR is merged, the baseline figures are then updated in astropy-data. This means we would no longer need to update astropy-data before a PR is merged which would be a big win as that is usually a barrier to contribution and has resulted in several languishing PRs.
To do:
Determine whether we want to split up the hash library files by e.g. freetype/libpng version as done in SunPy. This does add some complexity and might not be needed for now, so we might be able to defer until a separate PR.won't do for now, can cross that bridge if we need