File tree 1 file changed +4
-0
lines changed
1 file changed +4
-0
lines changed Original file line number Diff line number Diff line change @@ -4363,13 +4363,17 @@ def foo():
4363
4363
f'{ boldm } ZeroDivisionError{ reset } : { magenta } division by zero{ reset } ' ]
4364
4364
self .assertEqual (actual , expected )
4365
4365
4366
+ @force_not_colorized
4366
4367
def test_colorized_detection_checks_for_environment_variables (self ):
4367
4368
if sys .platform == "win32" :
4368
4369
virtual_patching = unittest .mock .patch ("nt._supports_virtual_terminal" , return_value = True )
4369
4370
else :
4370
4371
virtual_patching = contextlib .nullcontext ()
4371
4372
with virtual_patching :
4373
+
4374
+ flags = unittest .mock .MagicMock (ignore_environment = False )
4372
4375
with (unittest .mock .patch ("os.isatty" ) as isatty_mock ,
4376
+ unittest .mock .patch ("sys.flags" , flags ),
4373
4377
unittest .mock .patch ("traceback._can_colorize" , ORIGINAL_CAN_COLORIZE )):
4374
4378
isatty_mock .return_value = True
4375
4379
with unittest .mock .patch ("os.environ" , {'TERM' : 'dumb' }):
You can’t perform that action at this time.
0 commit comments