Skip to content

Commit 00895eb

Browse files
authored
Merge pull request #217 from mikelolasagasti/new-termcolor
Fix forcing color through termcolor
2 parents b0408fa + 15b0e9d commit 00895eb

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

pytest-shutil/pytest_shutil/cmdline.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ def chdir(dirname):
5252
class PrettyFormatter(object):
5353
def __init__(self, color=True):
5454
from termcolor import colored
55+
if color is False:
56+
os.environ["FORCE_COLOR"] = "true"
5557
self.color = color
5658
self.colored = colored
5759
self.buffer = []

pytest-shutil/tests/unit/test_cmdline.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ def test_umask(workspace):
1010
f.touch()
1111
assert (f.stat().st_mode & 0o777) == 0o464
1212

13-
def test_pretty_formatter():
13+
def test_pretty_formatter(monkeypatch):
14+
monkeypatch.setenv("FORCE_COLOR", "1")
1415
f = cmdline.PrettyFormatter()
1516
f.title('A Title')
1617
f.hr()

0 commit comments

Comments
 (0)