-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
gh-127873: Only check sys.flags.ignore_environment
for PYTHON*
env vars
#127877
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
@pablogsal Please could you have a look at this? Thanks! |
Why do we use names without the |
Yes, see https://force-color.org/ and https://no-color.org. |
Updated to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Although you can use support.force_not_colorized_test_class
in few more files.
Thank you for the reviews! |
Thanks @hugovk for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. |
Sorry, @hugovk, I could not cleanly backport this to
|
… `PYTHON*` env vars (pythonGH-127877) (cherry picked from commit 05d12ee) Co-authored-by: Hugo van Kemenade <[email protected]>
GH-129138 is a backport of this pull request to the 3.13 branch. |
When
-E
is passed (and thereforesys.flags.ignore_environment
is true), we should only ignore only env vars matchingPYTHON*
; in this case, onlyPYTHON_COLORS
.We should not ignore the other env vars:
FORCE_COLOR
/NO_COLOR
/TERM
.Re: https://docs.python.org/3/using/cmdline.html#cmdoption-E
Fixing this revealed some tests that failed because of inserted colour codes. For example, in "ZeroDivisionError: division by zero", the parts "ZeroDivisionError", ":" and "division by zero" are all different colours.
For these test cases, I wrapped them with the
@force_not_colorized
decorator, or, where there were a number of them, I wrapped the test class in the newforce_not_colorized_test_class
decorator. This was a suggestion from #127223 (comment). And from that PR, I replaced some of the numerous function decorators with the class decorator.can_colorize()
ignoresFORCE_COLOR
/NO_COLOR
/TERM
when-E
is set #127873