]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.13] gh-130293: Ensure test__colorize will pass on dumb terminals. (GH-130333)...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 20 Feb 2025 07:12:56 +0000 (08:12 +0100)
committerGitHub <noreply@github.com>
Thu, 20 Feb 2025 07:12:56 +0000 (07:12 +0000)
Ensure colorize tests will run on dumb terminals (or environment with TERM=dumb set)

(cherry picked from commit 1b070060c025a00d43566a6df65aa7631861d7af)

Co-authored-by: Russell Keith-Magee <russell@keith-magee.com>
Lib/test/test__colorize.py
Misc/NEWS.d/next/Tests/2025-02-20-13-39-12.gh-issue-130293.5igSsu.rst [new file with mode: 0644]
iOS/testbed/iOSTestbedTests/iOSTestbedTests.m

index 056a5306ced1832217e2c7b29e20e3d4dae6a7c9..42ee7b50a2a3ef58d6985ce8153799da14e2883c 100644 (file)
@@ -10,7 +10,7 @@ from test.support.os_helper import EnvironmentVarGuard
 @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 (file)
index 0000000..40c1784
--- /dev/null
@@ -0,0 +1,2 @@
+The tests of terminal colorization are no longer sensitive to the value of
+the ``TERM`` variable in the testing environment.
index 6db38253396c8d5c205be2db9c26d050d3dda84d..dd6e76f9496fe08ce30d4dd24c8ba5f7496d18e5 100644 (file)
@@ -28,7 +28,7 @@
     // 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