You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[MNT]: testing.compare.convert can use stale files #32675
Run pytest "lib/matplotlib/tests/test_lines.py::test_line_dashes[svg]"
Switch to main
Run pytest again
The result is an ImageComparisonFailure exception:
E matplotlib.testing.exceptions.ImageComparisonFailure: images not close (RMS 1.746):
E result_images/test_lines/line_dashes_svg.png
E result_images/test_lines/line_dashes-expected_svg.png
E result_images/test_lines/line_dashes_svg-failed-diff.png
The root issue is in convert():
# Only convert the file if the destination doesn't already exist or# is out of date.ifnotnewpath.exists() ornewpath.stat().st_mtime<path.stat().st_mtime:
…
"result_images/test_lines/line_dashes-expected_svg.png" was rendered using Inkscape. Since the file already exists and the modification time of the original hasn't changed, it is not re-rendered using resvg. This same issue will also occur if resvg is updated and produces a slightly different image.
We need to not use the existing image if it was created with a different renderer or version. There are plenty of ways to fix this, but I'm not sure which is the best way.
Activity
jklymak commentedon Nov 27, 2026
If the compare fails, could it rebuild the expected png just in case compare again and fail the second time ?
jklymak commentedon Nov 27, 2026
Or we could inject metadata using Pillow.