Fixing tests to account for the new terminal_supports_color variable
@@ -35,11 +35,18 @@ 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):
+ 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():
with pytest.raises(InvalidColorSetting):
use_color('herpaderp')
