mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-20 09:34:42 +04:00
Fixing tests to account for the new terminal_supports_color variable
This commit is contained in:
parent
3d777bb386
commit
710eef317a
1 changed files with 9 additions and 2 deletions
|
|
@ -35,11 +35,18 @@ def test_use_color_no_tty():
|
||||||
assert use_color('auto') is False
|
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.object(sys.stdout, 'isatty', return_value=True):
|
||||||
|
with mock.patch('pre_commit.color.terminal_supports_color', True):
|
||||||
assert use_color('auto') is 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():
|
def test_use_color_raises_if_given_shenanigans():
|
||||||
with pytest.raises(InvalidColorSetting):
|
with pytest.raises(InvalidColorSetting):
|
||||||
use_color('herpaderp')
|
use_color('herpaderp')
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue