@@ -4314,8 +4314,8 @@ def foo():
4314
4314
self .assertEqual (actual , expected )
4315
4315
4316
4316
def test_colorized_detection_checks_for_environment_variables (self ):
4317
- with unittest .mock .patch ("sys.stderr " ) as stderr_mock :
4318
- stderr_mock . isatty .return_value = True
4317
+ with unittest .mock .patch ("os.isatty " ) as isatty_mock :
4318
+ isatty_mock .return_value = True
4319
4319
with unittest .mock .patch ("os.environ" , {'TERM' : 'dumb' }):
4320
4320
self .assertEqual (traceback ._can_colorize (), False )
4321
4321
with unittest .mock .patch ("os.environ" , {'PY_COLORS' : '1' }):
@@ -4325,12 +4325,12 @@ def test_colorized_detection_checks_for_environment_variables(self):
4325
4325
with unittest .mock .patch ("os.environ" , {'NO_COLOR' : '1' }):
4326
4326
self .assertEqual (traceback ._can_colorize (), False )
4327
4327
with unittest .mock .patch ("os.environ" , {'NO_COLOR' : '1' , "PY_COLORS" : '1' }):
4328
- self .assertEqual (traceback ._can_colorize (), True )
4328
+ self .assertEqual (traceback ._can_colorize (), False )
4329
4329
with unittest .mock .patch ("os.environ" , {'FORCE_COLOR' : '1' }):
4330
4330
self .assertEqual (traceback ._can_colorize (), True )
4331
4331
with unittest .mock .patch ("os.environ" , {'FORCE_COLOR' : '1' , 'NO_COLOR' : '1' }):
4332
4332
self .assertEqual (traceback ._can_colorize (), False )
4333
- stderr_mock . isatty .return_value = False
4333
+ isatty_mock .return_value = False
4334
4334
self .assertEqual (traceback ._can_colorize (), False )
4335
4335
4336
4336
if __name__ == "__main__" :
0 commit comments