From 71d1e92e11093feb9a337f6d77078c5e75cbb92f Mon Sep 17 00:00:00 2001 From: Pete Rosenblum Date: Wed, 25 Feb 2026 23:55:18 -0500 Subject: Refs #36936 - Adjusted tests to set PYTHON_COLORS environment variable. When "FORCE_COLOR" was set in the environment (such as in django-docker-box) several test cases that rely on string comparisons against exception messages or command line results would fail due to ANSI escape sequences being present in the output. This change resolved the issue by setting the "PYTHON_COLORS" environment variable to "0" for those specific tests, which takes precendence over the presence of "FORCE_COLOR". --- tests/test_runner/test_debug_sql.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'tests/test_runner/test_debug_sql.py') diff --git a/tests/test_runner/test_debug_sql.py b/tests/test_runner/test_debug_sql.py index acf66633ef..61b60643c5 100644 --- a/tests/test_runner/test_debug_sql.py +++ b/tests/test_runner/test_debug_sql.py @@ -1,4 +1,5 @@ import logging +import os import unittest from io import StringIO from time import time @@ -183,6 +184,7 @@ class QueryFormatterTests(unittest.TestCase): @unittest.skipUnless( connection.vendor == "sqlite", "Only run on sqlite so we can check output SQL." ) +@mock.patch.dict(os.environ, {"PYTHON_COLORS": "0"}) class TestDebugSQL(unittest.TestCase): class PassingTest(TestCase): def runTest(self): -- cgit v1.3