gh-112730: Make the test suite resilient to color-activation environment variables (#117672)

This commit is contained in:
Pablo Galindo Salgado 2024-04-24 21:25:22 +01:00 committed by GitHub
parent 59a4d52973
commit 345e1e04ec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 89 additions and 16 deletions

View file

@ -8,6 +8,7 @@ import unittest
from unittest import mock
import idlelib
from idlelib.idle_test.mock_idle import Func
from test.support import force_not_colorized
idlelib.testing = True # Use {} for executing test user code.
@ -46,6 +47,7 @@ class ExceptionTest(unittest.TestCase):
"Did you mean: 'real'?\n"),
)
@force_not_colorized
def test_get_message(self):
for code, exc, msg in self.data:
with self.subTest(code=code):
@ -57,6 +59,7 @@ class ExceptionTest(unittest.TestCase):
expect = f'{exc.__name__}: {msg}'
self.assertEqual(actual, expect)
@force_not_colorized
@mock.patch.object(run, 'cleanup_traceback',
new_callable=lambda: (lambda t, e: None))
def test_get_multiple_message(self, mock):