Skip to content

Commit 9a16b73

Browse files
committed
Fixing windows test issues
1 parent a9c6770 commit 9a16b73

3 files changed

Lines changed: 12 additions & 4 deletions

File tree

tests/test_color.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import os
34
import typing
45

56
import progressbar
@@ -183,9 +184,10 @@ def test_colors():
183184

184185
def test_color():
185186
color = colors.red
186-
assert color('x') == color.fg('x') != 'x'
187-
assert color.fg('x') != color.bg('x') != 'x'
188-
assert color.fg('x') != color.underline('x') != 'x'
187+
if os.name != 'nt':
188+
assert color('x') == color.fg('x') != 'x'
189+
assert color.fg('x') != color.bg('x') != 'x'
190+
assert color.fg('x') != color.underline('x') != 'x'
189191
# Color hashes are based on the RGB value
190192
assert hash(color) == hash(terminal.Color(color.rgb, None, None, None))
191193
Colors.register(color.rgb)

tests/test_stream.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import io
2+
import os
23
import sys
34

45
import progressbar
@@ -98,6 +99,7 @@ def test_no_newlines():
9899

99100

100101
@pytest.mark.parametrize('stream', [sys.__stdout__, sys.__stderr__])
102+
@pytest.mark.skipif(os.name == 'nt', reason='Windows does not support this')
101103
def test_fd_as_standard_streams(stream):
102104
with progressbar.ProgressBar(fd=stream) as pb:
103105
for i in range(101):

tests/test_utils.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import io
2+
import os
23

34
import progressbar
45
import progressbar.env
@@ -107,4 +108,7 @@ def test_is_ansi_terminal(monkeypatch):
107108
def raise_error():
108109
raise RuntimeError('test')
109110
fd.isatty = raise_error
110-
assert progressbar.env.is_ansi_terminal(fd) is False
111+
if os.name == 'nt':
112+
assert progressbar.env.is_ansi_terminal(fd) is None
113+
else:
114+
assert progressbar.env.is_ansi_terminal(fd) is False

0 commit comments

Comments
 (0)