Skip to content

Commit

Permalink
Fixing windows test issues
Browse files Browse the repository at this point in the history
  • Loading branch information
wolph committed Jan 25, 2024
1 parent a9c6770 commit 9a16b73
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
8 changes: 5 additions & 3 deletions tests/test_color.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from __future__ import annotations

import os
import typing

import progressbar
Expand Down Expand Up @@ -183,9 +184,10 @@ def test_colors():

def test_color():
color = colors.red
assert color('x') == color.fg('x') != 'x'
assert color.fg('x') != color.bg('x') != 'x'
assert color.fg('x') != color.underline('x') != 'x'
if os.name != 'nt':
assert color('x') == color.fg('x') != 'x'
assert color.fg('x') != color.bg('x') != 'x'
assert color.fg('x') != color.underline('x') != 'x'
# Color hashes are based on the RGB value
assert hash(color) == hash(terminal.Color(color.rgb, None, None, None))
Colors.register(color.rgb)
Expand Down
2 changes: 2 additions & 0 deletions tests/test_stream.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import io
import os
import sys

import progressbar
Expand Down Expand Up @@ -98,6 +99,7 @@ def test_no_newlines():


@pytest.mark.parametrize('stream', [sys.__stdout__, sys.__stderr__])
@pytest.mark.skipif(os.name == 'nt', reason='Windows does not support this')
def test_fd_as_standard_streams(stream):
with progressbar.ProgressBar(fd=stream) as pb:
for i in range(101):
Expand Down
6 changes: 5 additions & 1 deletion tests/test_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import io
import os

import progressbar
import progressbar.env
Expand Down Expand Up @@ -107,4 +108,7 @@ def test_is_ansi_terminal(monkeypatch):
def raise_error():
raise RuntimeError('test')
fd.isatty = raise_error
assert progressbar.env.is_ansi_terminal(fd) is False
if os.name == 'nt':
assert progressbar.env.is_ansi_terminal(fd) is None
else:
assert progressbar.env.is_ansi_terminal(fd) is False

0 comments on commit 9a16b73

Please sign in to comment.