Repository navigation
ci_expected_failures: --help works and a bad argument is one error line with exit 2 (EGEN-CIEXPECTED-CLI) - #6320
Open
evilclanker9000 wants to merge 3 commits into
Conversation
…ot a traceback main() called int(EXIT_STATUS) and open(FAILED_LIST) unguarded, so a workflow step that passed a non-numeric status or a list that does not exist ended in a ValueError/FileNotFoundError traceback (exit 1) instead of naming the argument. Each is now one line on stderr and exit 2, the usage-error code the script already returns for missing arguments.
argv0 of -h/--help was counted as a missing argument, so the script printed its docstring to stderr and returned 2. It now prints the same text on stdout and returns 0, like the other scripts under scripts/ and tools/.
…nput-error exit The macOS paragraph named scripts/ci_expected_failures.py without its arguments or what it does with a bad one, so a reader had to open the script to learn the list/status order and that an unreadable list is one line, not a traceback.
|
Independent verification on Windows 11 (CPython 3.14.0, CPU only, no game files):
LGTM! AI-assisted. |
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.
EGEN-CIEXPECTED-CLI
What changed and why
scripts/ci_expected_failures.pyjudges a CI run, but it treated its own arguments as trusted:--help(or-h) was counted as a missing argument, so it printed the docstring to stderr and returned 2. It now prints the same text on stdout and returns 0, as the other scripts and tools do.int(argv[1])andopen(argv[0])were unguarded, so a non-numericEXIT_STATUSor aFAILED_LISTthat does not exist ended in aValueError/FileNotFoundErrortraceback with exit 1. Each is now one line on stderr and exit 2, the usage-error code the script already returns for a missing argument.The command line is unchanged; both workflow steps (
.github/workflows/runtime.yml:551and:574) pass a list and a numeric status as before.Test
python -I tests/test_ci_expected_failures.py(no game files, no GPU):scripts/ci_expected_failures.pyfrom561b65a8:Ran 11 tests ... FAILED (failures=1, errors=2).test_help_prints_the_usage_and_succeedsfails (it returned 2), and the two input-error tests end in the tracebacks (code, lines = judge(failed, int(argv[1]), expected)).Ran 11 tests in 0.018s-OK, exit 0.End to end:
python -m compileall -q scripts testspasses.GPU
No GPU needed.
Notes
docs/testing.mdgained one sentence with the command line and that exit code.argparse, somain(argv)keeps returning an int (the existingtest_missing_arguments_is_a_usage_errorcalls it that way) and the judged output stays byte-for-byte the same.--help, and the docs sentence.AI-assisted.