mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
support colors on windows during git better
This commit is contained in:
parent
34e9d11786
commit
9fc5a9316e
2 changed files with 9 additions and 9 deletions
|
|
@ -29,26 +29,26 @@ def test_use_color_always():
|
|||
|
||||
|
||||
def test_use_color_no_tty():
|
||||
with mock.patch.object(sys.stdout, 'isatty', return_value=False):
|
||||
with mock.patch.object(sys.stderr, 'isatty', return_value=False):
|
||||
assert use_color('auto') is False
|
||||
|
||||
|
||||
def test_use_color_tty_with_color_support():
|
||||
with mock.patch.object(sys.stdout, 'isatty', return_value=True):
|
||||
with mock.patch.object(sys.stderr, 'isatty', return_value=True):
|
||||
with mock.patch('pre_commit.color.terminal_supports_color', True):
|
||||
with envcontext.envcontext((('TERM', envcontext.UNSET),)):
|
||||
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.object(sys.stderr, 'isatty', return_value=True):
|
||||
with mock.patch('pre_commit.color.terminal_supports_color', False):
|
||||
with envcontext.envcontext((('TERM', envcontext.UNSET),)):
|
||||
assert use_color('auto') is False
|
||||
|
||||
|
||||
def test_use_color_dumb_term():
|
||||
with mock.patch.object(sys.stdout, 'isatty', return_value=True):
|
||||
with mock.patch.object(sys.stderr, 'isatty', return_value=True):
|
||||
with mock.patch('pre_commit.color.terminal_supports_color', True):
|
||||
with envcontext.envcontext((('TERM', 'dumb'),)):
|
||||
assert use_color('auto') is False
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue