mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 21:51:50 +00:00 
			
		
		
		
	gh-112730: Make the test suite resilient to color-activation environment variables (#117672)
This commit is contained in:
		
							parent
							
								
									59a4d52973
								
							
						
					
					
						commit
						345e1e04ec
					
				
					 13 changed files with 89 additions and 16 deletions
				
			
		|  | @ -12,7 +12,8 @@ | |||
| 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 @@ def __str__(self): | |||
| 
 | ||||
| # 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 @@ def write_source(self, source): | |||
|         _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 @@ def test_assertion_error_location(self): | |||
|                 result = self.write_source(source) | ||||
|                 self.assertEqual(result[-3:], expected) | ||||
| 
 | ||||
|     @force_not_colorized | ||||
|     def test_multiline_not_highlighted(self): | ||||
|         cases = [ | ||||
|             (""" | ||||
|  | @ -2102,6 +2106,7 @@ def test_multiline_not_highlighted(self): | |||
| 
 | ||||
| 
 | ||||
| class SyntaxErrorTests(unittest.TestCase): | ||||
|     @force_not_colorized | ||||
|     def test_range_of_offsets(self): | ||||
|         cases = [ | ||||
|             # Basic range from 2->7 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Pablo Galindo Salgado
						Pablo Galindo Salgado