Skip to content

Commit

Permalink
remove all platfrom checks from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Brennen Raimer authored and norweeg committed Nov 24, 2020
1 parent ae8b95a commit c95d85d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 35 deletions.
1 change: 0 additions & 1 deletion halo/halo.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
decode_utf_8_text,
get_environment,
get_terminal_columns,
is_supported,
is_text_type,
encode_utf_8_text,
)
Expand Down
25 changes: 6 additions & 19 deletions tests/test_halo.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from spinners.spinners import Spinners

from halo import Halo
from halo._utils import get_terminal_columns, is_supported
from halo._utils import get_terminal_columns
from tests._utils import strip_ansi, find_colors, encode_utf_8_text, decode_utf_8_text

from termcolor import COLORS
Expand All @@ -26,12 +26,8 @@
else:
get_coded_text = decode_utf_8_text

if is_supported():
frames = [get_coded_text(frame) for frame in Spinners['dots'].value['frames']]
default_spinner = Spinners['dots'].value
else:
frames = [get_coded_text(frame) for frame in Spinners['line'].value['frames']]
default_spinner = Spinners['line'].value
frames = [get_coded_text(frame) for frame in Spinners['dots'].value['frames']]
default_spinner = Spinners['dots'].value


class SpecificException(Exception):
Expand Down Expand Up @@ -127,10 +123,7 @@ def test_text_spinner_color(self):

def test_spinner_getter(self):
instance = Halo()
if is_supported():
default_spinner_value = "dots"
else:
default_spinner_value = "line"
default_spinner_value = "dots"

instance.spinner = default_spinner_value
self.assertEqual(default_spinner, instance.spinner)
Expand Down Expand Up @@ -368,16 +361,10 @@ def test_spinner_getters_setters(self):
self.assertEqual(spinner.text_color, 'red')
self.assertEqual(spinner.color, 'red')

if is_supported():
self.assertEqual(spinner.spinner, Spinners['dots12'].value)
else:
self.assertEqual(spinner.spinner, default_spinner)
self.assertEqual(spinner.spinner, Spinners['dots12'].value)

spinner.spinner = 'dots11'
if is_supported():
self.assertEqual(spinner.spinner, Spinners['dots11'].value)
else:
self.assertEqual(spinner.spinner, default_spinner)
self.assertEqual(spinner.spinner, Spinners['dots11'].value)

spinner.spinner = 'foo_bar'
self.assertEqual(spinner.spinner, default_spinner)
Expand Down
20 changes: 5 additions & 15 deletions tests/test_halo_notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from spinners.spinners import Spinners

from halo import HaloNotebook
from halo._utils import get_terminal_columns, is_supported
from halo._utils import get_terminal_columns
from tests._utils import decode_utf_8_text, encode_utf_8_text, find_colors, strip_ansi

from termcolor import COLORS
Expand All @@ -21,12 +21,8 @@
get_coded_text = decode_utf_8_text


if is_supported():
frames = [get_coded_text(frame) for frame in Spinners['dots'].value['frames']]
default_spinner = Spinners['dots'].value
else:
frames = [get_coded_text(frame) for frame in Spinners['line'].value['frames']]
default_spinner = Spinners['line'].value
frames = [get_coded_text(frame) for frame in Spinners['dots'].value['frames']]
default_spinner = Spinners['dots'].value


class TestHaloNotebook(unittest.TestCase):
Expand Down Expand Up @@ -327,16 +323,10 @@ def test_spinner_getters_setters(self):
self.assertEqual(spinner.text, 'bar')
self.assertEqual(spinner.color, 'red')

if is_supported():
self.assertEqual(spinner.spinner, Spinners['dots12'].value)
else:
self.assertEqual(spinner.spinner, default_spinner)
self.assertEqual(spinner.spinner, Spinners['dots12'].value)

spinner.spinner = 'dots11'
if is_supported():
self.assertEqual(spinner.spinner, Spinners['dots11'].value)
else:
self.assertEqual(spinner.spinner, default_spinner)
self.assertEqual(spinner.spinner, Spinners['dots11'].value)

spinner.spinner = 'foo_bar'
self.assertEqual(spinner.spinner, default_spinner)
Expand Down

0 comments on commit c95d85d

Please sign in to comment.