Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Lib/test/test_traceback.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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:
Expand Down
4 changes: 3 additions & 1 deletion Lib/test/test_tracemalloc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Loading