diff options
author | Sorin Sbarnea <sorin.sbarnea@gmail.com> | 2022-11-21 20:45:57 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-21 20:45:57 -0800 |
commit | 991ac4d42c644846ca1e21403547da23864ea908 (patch) | |
tree | a7b482d4f79671b0bb96a6f30ba36125ac28f7ac /tests | |
parent | f99073c9f113b0d6d34555bb8d11d99b294b127e (diff) | |
download | tox-git-991ac4d42c644846ca1e21403547da23864ea908.tar.gz |
Disable coloring with TERM=dumb or NO_COLOR (#2541)
* Disable coloring with TERM=dumb or NO_COLOR
Fixes: #1290
Related: https://no-color.org/
* [pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
* Add changelog fragment
* Fixed logic
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/config/cli/test_parser.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/config/cli/test_parser.py b/tests/config/cli/test_parser.py index 3b965d0d..2cbf21d7 100644 --- a/tests/config/cli/test_parser.py +++ b/tests/config/cli/test_parser.py @@ -31,6 +31,7 @@ def test_parser_const_with_default_none(monkeypatch: MonkeyPatch) -> None: @pytest.mark.parametrize("no_color", [None, "0", "1"]) @pytest.mark.parametrize("force_color", [None, "0", "1"]) @pytest.mark.parametrize("tox_color", [None, "bad", "no", "yes"]) +@pytest.mark.parametrize("term", [None, "xterm", "dumb"]) def test_parser_color( monkeypatch: MonkeyPatch, mocker: MockerFixture, @@ -38,8 +39,14 @@ def test_parser_color( force_color: str | None, tox_color: str | None, is_atty: bool, + term: str | None, ) -> None: - for key, value in {"NO_COLOR": no_color, "TOX_COLORED": tox_color, "FORCE_COLOR": force_color}.items(): + for key, value in { + "NO_COLOR": no_color, + "TOX_COLORED": tox_color, + "FORCE_COLOR": force_color, + "TERM": term, + }.items(): if value is None: monkeypatch.delenv(key, raising=False) else: @@ -53,6 +60,8 @@ def test_parser_color( expected = False elif force_color == "1": expected = True + elif term == "dumb": + expected = False else: expected = is_atty |