https://github.com/python/cpython/commit/1b070060c025a00d43566a6df65aa7631861d7af
commit: 1b070060c025a00d43566a6df65aa7631861d7af
branch: main
author: Russell Keith-Magee <[email protected]>
committer: freakboy3742 <[email protected]>
date: 2025-02-20T06:49:18Z
summary:

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

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

files:
A Misc/NEWS.d/next/Tests/2025-02-20-13-39-12.gh-issue-130293.5igSsu.rst
M Lib/test/test__colorize.py
M iOS/testbed/iOSTestbedTests/iOSTestbedTests.m

diff --git a/Lib/test/test__colorize.py b/Lib/test/test__colorize.py
index 056a5306ced183..42ee7b50a2a3ef 100644
--- a/Lib/test/test__colorize.py
+++ b/Lib/test/test__colorize.py
@@ -10,7 +10,7 @@
 @contextlib.contextmanager
 def clear_env():
     with EnvironmentVarGuard() as mock_env:
-        for var in "FORCE_COLOR", "NO_COLOR", "PYTHON_COLORS":
+        for var in "FORCE_COLOR", "NO_COLOR", "PYTHON_COLORS", "TERM":
             mock_env.unset(var)
         yield mock_env
 
diff --git 
a/Misc/NEWS.d/next/Tests/2025-02-20-13-39-12.gh-issue-130293.5igSsu.rst 
b/Misc/NEWS.d/next/Tests/2025-02-20-13-39-12.gh-issue-130293.5igSsu.rst
new file mode 100644
index 00000000000000..40c1784f6f1e54
--- /dev/null
+++ b/Misc/NEWS.d/next/Tests/2025-02-20-13-39-12.gh-issue-130293.5igSsu.rst
@@ -0,0 +1,2 @@
+The tests of terminal colorization are no longer sensitive to the value of
+the ``TERM`` variable in the testing environment.
diff --git a/iOS/testbed/iOSTestbedTests/iOSTestbedTests.m 
b/iOS/testbed/iOSTestbedTests/iOSTestbedTests.m
index 6db38253396c8d..dd6e76f9496fe0 100644
--- a/iOS/testbed/iOSTestbedTests/iOSTestbedTests.m
+++ b/iOS/testbed/iOSTestbedTests/iOSTestbedTests.m
@@ -28,7 +28,7 @@ - (void)testPython {
     // Xcode log can't display color. Stdout will report that it is *not* a
     // TTY.
     setenv("NO_COLOR", "1", true);
-    setenv("PY_COLORS", "0", true);
+    setenv("PYTHON_COLORS", "0", true);
 
     // Arguments to pass into the test suite runner.
     // argv[0] must identify the process; any subsequent arg

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to