Skip to content

gh-130293: Ensure test__colorize will pass on dumb terminals. #130333

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

Merged
merged 2 commits into from
Feb 20, 2025

Conversation

freakboy3742
Copy link
Contributor

@freakboy3742 freakboy3742 commented Feb 20, 2025

#129140 slightly modified the logic associated with determining if a console could be colorised. In doing so, the test became sensitive to the test environment's value for the TERM setting.

The iOS 18.2 test simulator sets TERM=dumb in the test environment - this makes some sense, as stdout/stderr handling is performed by the system log, which won't honor tty control sequences.

This appears to be a recent change to iOS; it wasn't true in iOS 17.2. With the recent update to the iOS buildbot, the problem became apparent.

However, the issue isn't iOS specific - it will occur on any machine where TERM=dumb is set in the testing environment. On macOS, I can reproduce the issue with:

TERM=dumb python3.14 -m test test__colorize

This PR ensures that TERM is correctly mocked as part of the colorise test, and normalizes the name used by the iOS Testbed to disable terminal colors.

@freakboy3742
Copy link
Contributor Author

!buildbot iOS

@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @freakboy3742 for commit 096c689 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F130333%2Fmerge

The command will test the builders whose names match following regular expression: iOS

The builders matched are:

  • iOS ARM64 Simulator PR

Copy link
Member

@hugovk hugovk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@freakboy3742
Copy link
Contributor Author

The iOS buildbot is currently failing because of changes introduced in #130007 and #130318 that are unrelated to this change. The build log show this PR as passing the (previously failed) test__colorize.

Co-authored-by: Hugo van Kemenade <[email protected]>
@freakboy3742 freakboy3742 enabled auto-merge (squash) February 20, 2025 06:21
@freakboy3742 freakboy3742 merged commit 1b07006 into python:main Feb 20, 2025
39 checks passed
@miss-islington-app
Copy link

Thanks @freakboy3742 for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 20, 2025
…ythonGH-130333)

Ensure colorize tests will run on dumb terminals (or environment with TERM=dumb set)
Co-authored-by: Hugo van Kemenade <[email protected]>
(cherry picked from commit 1b07006)

Co-authored-by: Russell Keith-Magee <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Feb 20, 2025

GH-130334 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Feb 20, 2025
@freakboy3742 freakboy3742 deleted the ios-colorize branch February 20, 2025 06:51
freakboy3742 added a commit that referenced this pull request Feb 20, 2025
…H-130333) (#130334)

Ensure colorize tests will run on dumb terminals (or environment with TERM=dumb set)

(cherry picked from commit 1b07006)

Co-authored-by: Russell Keith-Magee <[email protected]>
freakboy3742 added a commit to freakboy3742/cpython that referenced this pull request Mar 16, 2025
…nals. (pythonGH-130333) (python#130334)

Ensure colorize tests will run on dumb terminals (or environment with TERM=dumb set)

(cherry picked from commit 1b07006)

Co-authored-by: Russell Keith-Magee <[email protected]>
freakboy3742 added a commit to freakboy3742/cpython that referenced this pull request Mar 16, 2025
…nals. (pythonGH-130333) (python#130334)

Ensure colorize tests will run on dumb terminals (or environment with TERM=dumb set)

(cherry picked from commit 1b07006)

Co-authored-by: Russell Keith-Magee <[email protected]>
freakboy3742 added a commit to freakboy3742/cpython that referenced this pull request Mar 16, 2025
…als. (pythonGH-130333) (python#130334)

Ensure colorize tests will run on dumb terminals (or environment with TERM=dumb set)

(cherry picked from commit 1b07006)

Co-authored-by: Russell Keith-Magee <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants