summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tests/admin_scripts/tests.py2
-rw-r--r--tests/test_runner/test_debug_sql.py2
-rw-r--r--tests/test_utils/test_simpletestcase.py2
3 files changed, 6 insertions, 0 deletions
diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py
index 3b5b0380f0..114d819847 100644
--- a/tests/admin_scripts/tests.py
+++ b/tests/admin_scripts/tests.py
@@ -134,6 +134,7 @@ class AdminScriptTestCase(SimpleTestCase):
python_path.extend(ext_backend_base_dirs)
test_environ["PYTHONPATH"] = os.pathsep.join(python_path)
test_environ["PYTHONWARNINGS"] = ""
+ test_environ["PYTHON_COLORS"] = "0"
p = subprocess.run(
[sys.executable, *args],
@@ -2551,6 +2552,7 @@ class ArgumentOrder(AdminScriptTestCase):
)
+@mock.patch.dict(os.environ, {"PYTHON_COLORS": "0"})
class ExecuteFromCommandLine(SimpleTestCase):
def test_program_name_from_argv(self):
"""
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):
diff --git a/tests/test_utils/test_simpletestcase.py b/tests/test_utils/test_simpletestcase.py
index c6aa314944..c09c68db0c 100644
--- a/tests/test_utils/test_simpletestcase.py
+++ b/tests/test_utils/test_simpletestcase.py
@@ -1,3 +1,4 @@
+import os
import unittest
from io import StringIO
from unittest import mock
@@ -19,6 +20,7 @@ class ErrorTestCase(SimpleTestCase):
pass
+@mock.patch.dict(os.environ, {"PYTHON_COLORS": "0"})
@mock.patch.object(ErrorTestCase, "_post_teardown")
@mock.patch.object(ErrorTestCase, "_pre_setup")
class DebugInvocationTests(SimpleTestCase):