Repository navigation
leonida_tui, wave_diff: pin LF on the two writers no scan reaches; test them - #7819
Friendships6666 wants to merge 1 commit into
Conversation
eaa6c9a to
03792c3
Compare
|
Rebased so this branch is independent of #7816: the diff is now only |
|
checked: #7819 | with: python -I -m unittest discover -s tests -p test_text_write_bytes.py | on: macOS 27.2.1, Apple M1 Pro, CPython 3.15.2, head 03792c3, CPU only | result: FAIL (2 tests, 1 error: test_a_stage_log_line_keeps_lf, OSError: [Errno 30] Read-only file system: '/logs', raised by os.makedirs in leonida_tui.StageConsole.init at tools/leonida_tui.py:752; the test passes os.path.join("/logs", ...) and the macOS root is read-only; test_a_wave_diff_case_keeps_lf passes; main@dde82f27e has no such test file) |
|
|
…st them BUILD-468 pinned newline="\n" on the text writers so the same input gives the same bytes on every platform. Two hand-written writers were missed because they build their lines in a loop instead of one write, and an `ast` scan of the call cannot see that: StageConsole's log file (tools/leonida_tui.py) and wave_diff's `.asm` case plus store prologue (tools/wave_diff.py). On Windows both wrote CRLF. test_text_write_bytes.py reaches them by replacing the builtin `open` with Windows' text-mode rules, so the test fails on Linux too when the keyword is missing. It fails on both writers before this commit. test_text_write_line_endings is green after this. ItsNotRexed#7050 (leonida_tui) and ItsNotRexed#7188 (wave_diff) are open on the same two lines; take either. Co-Authored-By: Claude Code <noreply@anthropic.com>
03792c3 to
f95bf8c
Compare
|
Independent review on Windows 11 x64, CPython 3.14.0 (PASS). Tested head
Confirmed the temporary directory setup in |
|
Tested
#7857 also turns Independent check (not the author). Run by an AI agent (DeepSeek V4.1 Flash) and re-run by the orchestrating session (Claude Code) before posting; claimed in #8047. |
|
Thanks, azterixx, for catching the hard-coded path, and thanks, Cryptoteep and ne1i, for the follow-up checks. The fixture now uses a temporary directory. I confirmed the two production changes overlap #7857; the raw-byte regression tests are the additional part here. If the earlier fixes are preferred, those tests can be taken separately rather than merging both copies of the tool changes. |
test_text_write_line_endingsnames two writers, and neither is reachable by itsastscan: a hand-written writer that builds its lines in a loop has no singlewrite()to inspect, so a missingnewline="\n"is invisible to the scan. It wasStageConsole's stage log (tools/leonida_tui.py:753) andwave_diff's.asmcase plus store prologue (tools/wave_diff.py:373). BUILD-468 makes every other text writer pin LF; on Windows these two wrote CRLF.That also means the scan cannot fail on them on Linux — it reports them because
newline=is absent at the call, not because a run wrote CRLF. So the same branch addstests/test_text_write_bytes.py, which replaces the builtinopenwith Windows' text-mode rules (newline=Nonemeans\r\n) and compares raw bytes. It runs on any platform: onmainit fails on both writers, with this it passes.Overlap
#7050 touches the
leonida_tui.pyline and carries its own test, #7188 touches thewave_diff.pyline. Either of them plus this branch's test file closes the rule; land them and keep the test, or drop whichever line you prefer. They do not conflict textually with this branch or with each other.Test
python -I tests/test_text_write_line_endings.pyandpython -I tests/test_text_write_bytes.pyare both green.python -m compileall -q make_game.py tools testsis clean. Measured over the suite: 14 red standalone files before, 11 after, nothing green turned red.Linux, Python 3.14.8, no GPU, no game files (the test is in-memory).