diff options
author | Pablo Galindo Salgado <Pablogsal@gmail.com> | 2024-04-24 20:25:22 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-24 20:25:22 (GMT) |
commit | 345e1e04ec72698a1e257c805b3840d9f55eb80d (patch) | |
tree | 7a96eb0b69525fa33dd552b4ba952c4c857e3896 /Lib/test/test_exceptions.py | |
parent | 59a4d52973ca73bd739f914e88243a31dbef6b32 (diff) | |
download | cpython-345e1e04ec72698a1e257c805b3840d9f55eb80d.zip cpython-345e1e04ec72698a1e257c805b3840d9f55eb80d.tar.gz cpython-345e1e04ec72698a1e257c805b3840d9f55eb80d.tar.bz2 |
gh-112730: Make the test suite resilient to color-activation environment variables (#117672)
Diffstat (limited to 'Lib/test/test_exceptions.py')
-rw-r--r-- | Lib/test/test_exceptions.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/test/test_exceptions.py b/Lib/test/test_exceptions.py index 1224f14..3138f50 100644 --- a/Lib/test/test_exceptions.py +++ b/Lib/test/test_exceptions.py @@ -12,7 +12,8 @@ from textwrap import dedent from test.support import (captured_stderr, check_impl_detail, cpython_only, gc_collect, no_tracing, script_helper, - SuppressCrashReport) + SuppressCrashReport, + force_not_colorized) from test.support.import_helper import import_module from test.support.os_helper import TESTFN, unlink from test.support.warnings_helper import check_warnings @@ -41,6 +42,7 @@ class BrokenStrException(Exception): # XXX This is not really enough, each *operation* should be tested! + class ExceptionTests(unittest.TestCase): def raise_catch(self, exc, excname): @@ -1994,6 +1996,7 @@ class AssertionErrorTests(unittest.TestCase): _rc, _out, err = script_helper.assert_python_failure('-Wd', '-X', 'utf8', TESTFN) return err.decode('utf-8').splitlines() + @force_not_colorized def test_assertion_error_location(self): cases = [ ('assert None', @@ -2070,6 +2073,7 @@ class AssertionErrorTests(unittest.TestCase): result = self.write_source(source) self.assertEqual(result[-3:], expected) + @force_not_colorized def test_multiline_not_highlighted(self): cases = [ (""" @@ -2102,6 +2106,7 @@ class AssertionErrorTests(unittest.TestCase): class SyntaxErrorTests(unittest.TestCase): + @force_not_colorized def test_range_of_offsets(self): cases = [ # Basic range from 2->7 |