Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 01d3a72 commit 8520455Copy full SHA for 8520455
1 file changed
tests/color_test.py
@@ -1,5 +1,6 @@
1
from __future__ import unicode_literals
2
3
+import os
4
import sys
5
6
import mock
@@ -50,3 +51,20 @@ def test_use_color_tty_without_color_support():
50
51
def test_use_color_raises_if_given_shenanigans():
52
with pytest.raises(InvalidColorSetting):
53
use_color('herpaderp')
54
+
55
56
+def test_no_color_env_unset():
57
+ with mock.patch.dict(os.environ):
58
+ if 'NO_COLOR' in os.environ:
59
+ del os.environ['NO_COLOR']
60
+ assert use_color('always') is True
61
62
63
+def test_no_color_env_empty():
64
+ with mock.patch.dict(os.environ, NO_COLOR=''):
65
66
67
68
+def test_no_color_env_non_empty():
69
+ with mock.patch.dict(os.environ, NO_COLOR=' '):
70
+ assert use_color('always') is False
0 commit comments