Fix syntax and logic issues in tests_to_html.py#2974
Merged
jstone-lucasfilm merged 1 commit intoJun 12, 2026
Merged
Conversation
Replace hardcoded slice lengths with Python's built-in removesuffix() to correctly support variable-length language suffixes (like _glsl.png). Also fix a CSS formatting syntax error and a copy-paste bug that broke three-way comparisons by using inputdir2 instead of inputdir3.
ppenenko
commented
Jun 10, 2026
| # Preserve inline background-color when printing to PDF, so transparent renders | ||
| # don't vanish into the white page. | ||
| fh.write("@media print { * { print-color-adjust: exact; -webkit-print-color-adjust: exact; } }") | ||
| fh.write("@media print { * { print-color-adjust: exact; -webkit-print-color-adjust: exact; } }\n") |
ppenenko
commented
Jun 10, 2026
| diffRms1 = diffRms2 = diffRms3 = None | ||
|
|
||
| if file1 and file2 and DIFF_ENABLED and args.CREATE_DIFF: | ||
| diffPath1 = fullPath1[0:-8] + "_" + args.lang1 + "-1_vs_" + args.lang2 + "-2_diff.png" |
Contributor
Author
There was a problem hiding this comment.
-8 is right for osl but not for glsl
ppenenko
commented
Jun 10, 2026
| file3 = file1[:-len(postFix)] + args.lang3 + ".png" | ||
| path3 = os.path.join(args.inputdir2, path1[len(args.inputdir1)+1:]) | ||
| file3 = f"{file1.removesuffix(postFix)}_{args.lang3}.png" | ||
| path3 = os.path.join(args.inputdir3, path1[len(args.inputdir1)+1:]) |
Contributor
Author
There was a problem hiding this comment.
Copy-and-paste bug.
jstone-lucasfilm
approved these changes
Jun 12, 2026
jstone-lucasfilm
left a comment
Member
There was a problem hiding this comment.
Thanks for these fixes, @ppenenko!
tests_to_html.py
834c6a2
into
AcademySoftwareFoundation:main
36 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR addresses bugs in
tests_to_html.pythat affect the generation of HTML test reports:[0:-8]) with Python's built-inremovesuffix()method. This correctly handles variable-length language suffixes (e.g.,_glsl.pngwhich is 9 characters vs_osl.pngwhich is 8 characters), preventing filename truncation bugs.\n) to the@media printblock to prevent it from concatenating directly with the followingtdrule, which produces invalid CSS.path3was joined withargs.inputdir2instead ofargs.inputdir3.This fixes/addresses the following issue on the Autodesk fork:
Test plan
tests_to_html.pywith variable-length language suffixes (likeglslandosl) and verify that diff image paths are correctly constructed without truncation.inputdir3.