@@ -31,23 +31,27 @@ def test_parser_const_with_default_none(monkeypatch: MonkeyPatch) -> None:
31
31
@pytest .mark .parametrize ("no_color" , [None , "0" , "1" ])
32
32
@pytest .mark .parametrize ("force_color" , [None , "0" , "1" ])
33
33
@pytest .mark .parametrize ("tox_color" , [None , "bad" , "no" , "yes" ])
34
+ @pytest .mark .parametrize ("term" , [None , None , "xterm" , "dumb" ])
34
35
def test_parser_color (
35
36
monkeypatch : MonkeyPatch ,
36
37
mocker : MockerFixture ,
37
38
no_color : str | None ,
38
39
force_color : str | None ,
39
40
tox_color : str | None ,
40
41
is_atty : bool ,
42
+ term : str | None ,
41
43
) -> None :
42
- for key , value in {"NO_COLOR" : no_color , "TOX_COLORED" : tox_color , "FORCE_COLOR" : force_color }.items ():
44
+ for key , value in {"NO_COLOR" : no_color , "TOX_COLORED" : tox_color , "FORCE_COLOR" : force_color , "TERM" : term }.items ():
43
45
if value is None :
44
46
monkeypatch .delenv (key , raising = False )
45
47
else :
46
48
monkeypatch .setenv (key , value )
47
49
stdout_mock = mocker .patch ("tox.config.cli.parser.sys.stdout" )
48
50
stdout_mock .isatty .return_value = is_atty
49
51
50
- if tox_color in ("yes" , "no" ):
52
+ if term == 'dumb' :
53
+ expected = False
54
+ elif tox_color in ("yes" , "no" ):
51
55
expected = tox_color == "yes"
52
56
elif no_color == "1" :
53
57
expected = False
0 commit comments