File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -54,3 +54,30 @@ def test_is_terminal(monkeypatch):
5454
5555 # Sanity check
5656 assert progressbar .utils .is_terminal (fd ) is False
57+
58+
59+ def test_is_ansi_terminal (monkeypatch ):
60+ fd = io .StringIO ()
61+
62+ monkeypatch .delenv ('PROGRESSBAR_IS_TERMINAL' , raising = False )
63+ monkeypatch .delenv ('JPY_PARENT_PID' , raising = False )
64+
65+ assert progressbar .utils .is_ansi_terminal (fd ) is False
66+ assert progressbar .utils .is_ansi_terminal (fd , True ) is True
67+ assert progressbar .utils .is_ansi_terminal (fd , False ) is False
68+
69+ monkeypatch .setenv ('JPY_PARENT_PID' , '123' )
70+ assert progressbar .utils .is_ansi_terminal (fd ) is True
71+ monkeypatch .delenv ('JPY_PARENT_PID' )
72+
73+ # Sanity check
74+ assert progressbar .utils .is_ansi_terminal (fd ) is False
75+
76+ monkeypatch .setenv ('PROGRESSBAR_IS_TERMINAL' , 'true' )
77+ assert progressbar .utils .is_ansi_terminal (fd ) is False
78+ monkeypatch .setenv ('PROGRESSBAR_IS_TERMINAL' , 'false' )
79+ assert progressbar .utils .is_ansi_terminal (fd ) is False
80+ monkeypatch .delenv ('PROGRESSBAR_IS_TERMINAL' )
81+
82+ # Sanity check
83+ assert progressbar .utils .is_ansi_terminal (fd ) is False
You can’t perform that action at this time.
0 commit comments