Repository navigation
tools: the README card scripts name a picture argument that came out empty - #3345
Merged
Merged
Conversation
…empty
out_problem() judged a folder, a folder that is not there, a path through a file and a suffixless
name, so a name that came out empty fell through to the extension branch and answered
has no extension, so the format to write is unknown: pass a name ending in .png
a sentence that starts with a space and names no argument at all. tools/screendiff.py already answers
this shape with the value in repr and the shell variable that was probably empty, so the three card
scripts do the same, before anything is read. Exit statuses are unchanged.
assert_refused() looks for the picture path in the message, and the empty string is in every string, so that helper could not catch this shape. The empty and blank names ask for the argument in repr instead, over all three scripts, and the module docstring records why the helper missed it.
|
maintainer-bot review · suggests merge (p3) Thanks for spotting that Checks
This is a suggestion; a maintainer makes the final call. A maintainer can comment Reviewed by maintainer-bot · runs on 0G Private Computer |
Owner
|
Thanks @xbsheng, the three README card scripts now name an empty or blank picture argument before Pillow loads, still exiting 1, and the new test checks repr, exit code and empty stdout where the old assert_refused never could. |
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.
Tested on: no TV — the card scripts and their tests only; nothing here talks to a TV.
The three scripts that draw the README card answered a picture argument that came out empty with a sentence that names nothing:
out_problem()judged a folder, a folder that is not there, a path through a file and a suffixless name, so""(what"$OUT"gives with OUT unset, the way a reader runs these by hand) fell through to the extension branch. The message starts with a space, names no argument, and does not say where the name came from.tools/screendiff.pyalready answers this shape —--out was given as '', an empty name ... if the name came from a shell variable, that variable was empty— and these three scripts take the same line, judged inout_problem()before anything is read or Pillow is imported.The same shape was invisible to
tests/test_card_out_path.py:assert_refused()asks whether the path it passed is in the message, andstr("")is in every string, so an empty name passed any wording at all. The new test asks for the argument inreprand covers""and" "on all three scripts; the module docstring records why the helper could not catch it.Counter-proof:
tests/test_card_out_path.pyfrom this branch, in a worktree atfc148d5a(origin/main), fails six ways —AssertionError: "' '" not found in ' has no extension, ...' : readme_card.py does not name the picture argument it was given; on the branch all 10 tests pass. The four shapes that already answered keep their wording and their status, and the real-picture test still writes its PNG/JPEG with Pillow present.tools/readme_stats.py,tools/readme_featured.py,tools/readme_card.py: the empty-name branch, its docstring sentence and the comment above the guard; exit statuses unchanged (1, as the other shapes answer).tests/test_card_out_path.py: one test, two names × three scripts, and the docstring paragraph above.tv.json,PROMPT.md,disable.sh/check.py/restore.sh, Home guard,.github/orlauncher/file; no new file, no binary.CLEANYOURTV_STRICT=1 tools/venv/bin/python -m unittest discover -s tests→ 2936 OK (skipped=27), which is origin/mainfc148d5a's 2935 plus this test;python3 -I tools/gen_tables.py --checkexit 0; no shell changed.If this adds or changes a TV list
If this touches the launcher
launcher/changed.If this adds or changes a theme
If this adds a theme key (a switch)
If this adds an add-on
Self-check: no red line in POLICY —
tools/argument handling only, no install restriction, no root, no uninstall, no launcher network, no default changed for any TV; one topic (the picture argument of the three card scripts); duplicate check: no open PR touchestools/readme_stats.py,tools/readme_featured.py,tools/readme_card.pyortests/test_card_out_path.pyexcept #2569 and #2545, whose single hunk inreadme_stats.pyis theSTATSline (@@ -71,7 +71,7 @@), so no shared line;Tested onsays no TV because no TV is involved.