Mailing List Archive

gh-112730: Respect tests that require environment variables with no-colorize fixes (#118288)
https://github.com/python/cpython/commit/b43c7e1070e515b3e94043ff777ab83074234051
commit: b43c7e1070e515b3e94043ff777ab83074234051
branch: main
author: Pablo Galindo Salgado <Pablogsal@gmail.com>
committer: pablogsal <Pablogsal@gmail.com>
date: 2024-04-26T21:23:30+01:00
summary:

gh-112730: Respect tests that require environment variables with no-colorize fixes (#118288)

files:
M Lib/test/test_traceback.py
M Lib/test/test_tracemalloc.py

diff --git a/Lib/test/test_traceback.py b/Lib/test/test_traceback.py
index 19611937fc278b..8927fccc289320 100644
--- a/Lib/test/test_traceback.py
+++ b/Lib/test/test_traceback.py
@@ -384,6 +384,7 @@ def f():
])

@requires_subprocess()
+ @force_not_colorized
def test_encoded_file(self):
# Test that tracebacks are correctly printed for encoded source files:
# - correct line number (Issue2384)
@@ -410,7 +411,7 @@ def do_test(firstlines, message, charset, lineno):
""".format(firstlines, message))

process = subprocess.Popen([sys.executable, TESTFN],
- stdout=subprocess.PIPE, stderr=subprocess.STDOUT, env={})
+ stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
stdout, stderr = process.communicate()
stdout = stdout.decode(output_encoding).splitlines()
finally:
diff --git a/Lib/test/test_tracemalloc.py b/Lib/test/test_tracemalloc.py
index f685430a7d36ad..5755f7697de91a 100644
--- a/Lib/test/test_tracemalloc.py
+++ b/Lib/test/test_tracemalloc.py
@@ -8,6 +8,7 @@
interpreter_requires_environment)
from test import support
from test.support import os_helper
+from test.support import force_not_colorized

try:
import _testcapi
@@ -938,11 +939,12 @@ def test_env_limit(self):
stdout = stdout.rstrip()
self.assertEqual(stdout, b'10')

+ @force_not_colorized
def check_env_var_invalid(self, nframe):
with support.SuppressCrashReport():
ok, stdout, stderr = assert_python_failure(
'-c', 'pass',
- PYTHONTRACEMALLOC=str(nframe), __cleanenv=True)
+ PYTHONTRACEMALLOC=str(nframe))

if b'ValueError: the number of frames must be in range' in stderr:
return

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-leave@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: list-python-checkins@lists.gossamer-threads.com