From 710eef317ab1bce800636f1e2578a8b3133ca959 Mon Sep 17 00:00:00 2001 From: Jeffrey Rackauckas Date: Thu, 30 Aug 2018 19:39:37 -0700 Subject: [PATCH] Fixing tests to account for the new terminal_supports_color variable --- tests/color_test.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/color_test.py b/tests/color_test.py index 0b8a4d69..6e11765c 100644 --- a/tests/color_test.py +++ b/tests/color_test.py @@ -35,9 +35,16 @@ def test_use_color_no_tty(): assert use_color('auto') is False -def test_use_color_tty(): +def test_use_color_tty_with_color_support(): with mock.patch.object(sys.stdout, 'isatty', return_value=True): - assert use_color('auto') is True + with mock.patch('pre_commit.color.terminal_supports_color', True): + assert use_color('auto') is True + + +def test_use_color_tty_without_color_support(): + with mock.patch.object(sys.stdout, 'isatty', return_value=True): + with mock.patch('pre_commit.color.terminal_supports_color', False): + assert use_color('auto') is False def test_use_color_raises_if_given_shenanigans():