Skip to content

Commit 710eef3

Browse files
committed
Fixing tests to account for the new terminal_supports_color variable
1 parent 3d777bb commit 710eef3

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

tests/color_test.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,16 @@ def test_use_color_no_tty():
3535
assert use_color('auto') is False
3636

3737

38-
def test_use_color_tty():
38+
def test_use_color_tty_with_color_support():
3939
with mock.patch.object(sys.stdout, 'isatty', return_value=True):
40-
assert use_color('auto') is True
40+
with mock.patch('pre_commit.color.terminal_supports_color', True):
41+
assert use_color('auto') is True
42+
43+
44+
def test_use_color_tty_without_color_support():
45+
with mock.patch.object(sys.stdout, 'isatty', return_value=True):
46+
with mock.patch('pre_commit.color.terminal_supports_color', False):
47+
assert use_color('auto') is False
4148

4249

4350
def test_use_color_raises_if_given_shenanigans():

0 commit comments

Comments
 (0)