Skip to content
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

gh-127873: Only check sys.flags.ignore_environment for PYTHON* env vars #127877

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

hugovk
Copy link
Member

@hugovk hugovk commented Dec 12, 2024

When -E is passed (and therefore sys.flags.ignore_environment is true), we should only ignore only env vars matching PYTHON*; in this case, only PYTHON_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 then with the @force_not_colorized decorator, or, where there were a number of them, I wrapped the test class in the new force_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.

@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @hugovk for commit 80422ff 🤖

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Dec 13, 2024
@hugovk

This comment was marked as resolved.

@hugovk
Copy link
Member Author

hugovk commented Dec 17, 2024

@pablogsal Please could you have a look at this? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants