Repository navigation
Read the CLI help with terminal escapes stripped - #3598
Merged
Merged
Conversation
Python 3.14 colorizes argparse help, so `--format` and its choices are separated by a select-graphic-rendition escape and `USAGE_CHOICES` never matches. `test_no_duplicate_choices` and `test_help_example_uses_real_arguments` both fail on any developer machine running 3.14, and both pass in CI only because stdout there is not a terminal. `cli_help` now strips the escapes. Turning the color off through an environment variable would work today, but which variable and which interpreter honor it is outside this project's control, so the tests read what a reader sees instead. Verified passing with PYTHON_COLORS and FORCE_COLOR set, with PYTHON_COLORS and NO_COLOR clear, and with neither, and verified still failing when a duplicate `--format` choice is reintroduced. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Replaces #3596, which used British spellings in its branch name and prose. The fix is unchanged.
Python 3.14 colorizes argparse help, so
--formatand its choices are separated by a select-graphic-rendition escape:USAGE_CHOICESnever matches that, sotest_no_duplicate_choicesandtest_help_example_uses_real_argumentsboth fail on any developer machine running 3.14. They pass in CI only because stdout there is not a terminal, which means the 3.14 matrix job is not exercising what it looks like it is exercising.cli_helpnow strips the escapes. Turning the color off through an environment variable would work today, but which variable and which interpreter honor it is outside this project's control, so the tests read what a reader sees instead.Verified passing with
PYTHON_COLORS=1 FORCE_COLOR=1, withPYTHON_COLORS=0 NO_COLOR=1, and with neither set; and verified still failing when a duplicate--formatchoice is reintroduced, so the assertion it guards still bites.Merge order: independent of every other open pull request.
🤖 Generated with Claude Code