test(tools): cover prepare_release_notes truncation and file output #6693
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/6693"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from boykopovar/AnyPS5. Originally posted by bappisinsane on 2026-10-16T05:06:04Z.
What
Adds edge-case tests to
ReleaseNotesTests' moduletools/tests/test_package_release.py(ctestrelease_package) forprepare_release_notes:bodyraisesValueErrormain()with valid arguments writes both files, and exits on missing argumentsTested
python3 -m unittest tools/tests/test_package_release.py: all tests pass.Checklist
Imported from boykopovar/AnyPS5. Originally posted by jotitadev on 2026-10-16T05:36:04Z.
Review: COMMENTED
Ran this on macOS, head
f4c449832, basemain5d9dcc42d. Three things:1. The new file is not registered in CMake, so ctest and CI never run it. Every other file in
tools/tests/(37 of 37) has anadd_testin the rootCMakeLists.txt;test_prepare_release_notes.pyhas none, and the PR doesn't touch anyCMakeLists.txt.2.
prepare_release_notes.pyalready has tests.ReleaseNotesTestsintools/tests/test_package_release.py(ctestrelease_package) coversrelease_body(unchanged at the limit, including a Unicode body of exactly 125000 characters; only the "What's Changed" section removed, with\nand\r\n, with and without "New Contributors" and "Full Changelog"; an oversized remainder left as is) andprepare_notes(byte-exact full and body files, written into adist/subdirectory that doesn't exist yet). What this file adds is the non-stringbodyValueErrorand themain()argument parsing; those could go in that class instead.3. With Python 3.9.6 (Xcode's
/usr/bin/python3), 4 of the 12 tests error:in
test_writes_full_and_body_files,test_truncated_body_is_written_to_body_file,test_creates_parent_directoriesandtest_main_with_valid_arguments. The cause is not in this PR:prepare_notescallsPath.write_text(..., newline=""), which is Python 3.10+, and it already makesrelease_packagefail on 3.9 (x86_64 build configured with-DPython3_EXECUTABLE=/usr/bin/python3: 170/173,release_packageamong the 3). Withprepare_noteswritingfull.write_bytes(notes.encode("utf-8"))andbody.write_bytes(release_body(notes).encode("utf-8")), which keeps the output byte for byte, this file passes 12/12 on 3.9.6 and on 3.14.7.Machine: Apple M2 Max, macOS 27.2 (26B5091g). Method:
python3 -I tools/tests/test_prepare_release_notes.pywith/usr/bin/python3(3.9.6) and Homebrewpython3(3.14.7), on this head and with thewrite_byteschange above; relinker-only ctest arm64 and x86_64 under Rosetta.Written with AI assistance (Claude Code). I ran the builds and tests above on my machine.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T07:30:36Z.
The latest conventions run fails because the PR body leaves two required template fields unanswered:
Depends onneeds#Nornone, andAI-assistedneedsyesorno(see the annotations on run 38854018878). The earlier review also identifies that this new test file is not registered with CTest and overlaps existingrelease_packagecoverage; worth addressing those alongside the Python 3.9 compatibility report.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T07:50:35Z.
I opened #6728 with the production fix for the Python 3.9
Path.write_text(newline=...)failure. It uses UTF-8write_bytes, preserving the byte-exact behavior already covered byrelease_packagetests. The test-registration and overlap points from the review above remain separate.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T12:26:50Z.
The current conventions run fails only because the checklist is missing the required
Depends on: #NorDepends on: noneandAI-assisted: yes/noentries. TheWhat,TestedandChecklistsections are present; adding those two checklist answers should satisfy the reported template errors.Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-16T12:34:53Z.
One remaining review point on the current head: this PR only adds
tools/tests/test_prepare_release_notes.py; it does not register the file with CTest, and the existingReleaseNotesTestsintools/tests/test_package_release.pyalready cover the release-body truncation and output-writing behavior. Could you move the genuinely new cases (non-string input and CLI argument parsing) into that existing test module, or register the new file and keep only non-overlapping cases? The Python 3.9write_text(newline=...)production issue is separately covered by #6728.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-19T05:58:24Z.
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
tools/tests/test_package_release.pyImported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-19T08:44:34Z.
Checked the tests against
tools/prepare_release_notes.py: they now live in the registeredrelease_packagemodule, no duplication with the existing cases, and each pins real behaviour (non-string body error,main()args, parent dir creation, no-op truncation without the section, Full Changelog kept). I also fixed the PR body template (literal\ns made Conventions fail). Merged.