tests: look for regressions when converting PDFs #1089
Draft
+21
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I convert all the documents we have in our test suite and store them in a
reference
folder, and then compare this bit to bit, using pymupdf pixel buffers.We could use another diffing tool and tell it what's acceptable (if that exists), but I believe that in the end what matters most is the developer experience when we have an output that changes.
Two things come to mind:
Inspecting the diff
There are multiple tools that allow to do that, but I found that diff-pdf good and able to generate an output we can look at without having to run a GUI.
Produces this diff.pdf file for the changes between the 0.8.1 release and this commit.
Update the reference version
We should have a command to bump all the reference documents (or a specific one).
Status:
This PR currently only fails tests when there a change in the output. I plan to do the following:
Fixes #321