From 096c689545e1dcc5e1566d59e0deea76f33af254 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Thu, 20 Feb 2025 13:28:47 +0800 Subject: [PATCH 1/2] Ensure colorize tests will run on dumb terminals. --- 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..e4364329b9ab4a --- /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 sensitve 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 From ea913c171e80747161b288d3767dc5dd0b3ca5a0 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Thu, 20 Feb 2025 14:19:18 +0800 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com> --- .../next/Tests/2025-02-20-13-39-12.gh-issue-130293.5igSsu.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 index e4364329b9ab4a..40c1784f6f1e54 100644 --- 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 @@ -1,2 +1,2 @@ -The tests of terminal colorization are no longer sensitve to the value of -the TERM variable in the testing environment. +The tests of terminal colorization are no longer sensitive to the value of +the ``TERM`` variable in the testing environment.