Skip to content

Commit

Permalink
Test to ensure FORCE_COLOR works with empty value
Browse files Browse the repository at this point in the history
  • Loading branch information
darrenburns committed Sep 8, 2022
1 parent be7c97e commit f996337
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tests/test_console.py
Original file line number Diff line number Diff line change
Expand Up @@ -930,9 +930,9 @@ def test_capturing_no_stdout_and_no_stderr_files(monkeypatch):
assert capture.get() == "hello world\n"


@mock.patch.dict(os.environ, {"FORCE_COLOR": "anything"})
def test_force_color():
@pytest.mark.parametrize("env_value", ["", "something", "0"])
def test_force_color(env_value):
# Even though we use a non-tty file, the presence of FORCE_COLOR env var
# means is_terminal returns True.
console = Console(file=io.StringIO())
console = Console(file=io.StringIO(), _environ={"FORCE_COLOR": env_value})
assert console.is_terminal

0 comments on commit f996337

Please sign in to comment.