From b36214bb3ab9bcc6bcf43885fe4566c35e2e5522 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Thu, 20 Feb 2025 14:49:18 +0800 Subject: [PATCH] gh-130293: Ensure test__colorize will pass on dumb terminals. (GH-130333) Ensure colorize tests will run on dumb terminals (or environment with TERM=dumb set) Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> (cherry picked from commit 1b070060c025a00d43566a6df65aa7631861d7af) Co-authored-by: Russell Keith-Magee --- Lib/test/test__colorize.py | 2 +- .../next/Tests/2025-02-20-13-39-12.gh-issue-130293.5igSsu.rst | 2 ++ iOS/testbed/iOSTestbedTests/iOSTestbedTests.m | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 Misc/NEWS.d/next/Tests/2025-02-20-13-39-12.gh-issue-130293.5igSsu.rst 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