From 7755d61ba3375fae44c7fec034a8d2992ae86fc4 Mon Sep 17 00:00:00 2001 From: Jose A Lerma III Date: Wed, 10 Apr 2019 22:48:24 -0500 Subject: [PATCH 1/7] Update pylint dependency from 1.7.2 to 2.3.0 --- requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index cac91bf..9168e6f 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,5 +1,5 @@ coverage==4.4.1 nose==1.3.7 -pylint==1.7.2 +pylint==2.3.0 tox==2.8.2 twine==1.12.1 From 8fdf83bcb760ef568201c6d1f1b793d020018a2e Mon Sep 17 00:00:00 2001 From: Jose A Lerma III Date: Wed, 10 Apr 2019 22:49:03 -0500 Subject: [PATCH 2/7] Add whitelist for spinners compatible with Windows --- halo/halo.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/halo/halo.py b/halo/halo.py index 640d1af..6e0140c 100644 --- a/halo/halo.py +++ b/halo/halo.py @@ -261,6 +261,8 @@ def _get_spinner(self, spinner): Contains frames and interval defining spinner """ default_spinner = Spinners['dots'].value + windows_spinners = ['balloon', 'balloon2', 'bouncingBar', 'dqpb', 'flip', 'layer', 'line', 'pipe', + 'simpleDots', 'simpleDotsScrolling', 'star2', 'shark', 'toggle13'] if spinner and type(spinner) == dict: return spinner @@ -271,7 +273,10 @@ def _get_spinner(self, spinner): else: return default_spinner else: - return Spinners['line'].value + if all([is_text_type(spinner), spinner in Spinners.__members__, spinner in windows_spinners]): + return Spinners[spinner].value + else: + return Spinners['line'].value def _get_text(self, text): """Creates frames based on the selected animation From d6ab302b8d56ae178e68c9038954630255a2ccd4 Mon Sep 17 00:00:00 2001 From: Jose A Lerma III Date: Thu, 11 Apr 2019 00:11:56 -0500 Subject: [PATCH 3/7] Add test_windows_whitelist --- tests/test_halo.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/test_halo.py b/tests/test_halo.py index d357c0d..23cb902 100644 --- a/tests/test_halo.py +++ b/tests/test_halo.py @@ -551,6 +551,22 @@ def test_redirect_stdout(self): self.assertIn('foo', output[0]) + def test_windows_whitelist(self): + if is_supported(): + pass + else: + instance = Halo() + default_spinner_value = "line" + + instance.spinner = default_spinner_value + self.assertEqual(default_spinner, instance.spinner) + + instance.spinner = "balloon" + self.assertEqual(Spinners['balloon'].value, instance.spinner) + + instance.spinner = "monkey" + self.assertEqual(default_spinner, instance.spinner) + def tearDown(self): pass From 97ea331336f17ef36983f3a1fc413353f974b85c Mon Sep 17 00:00:00 2001 From: Jose A Lerma III Date: Thu, 11 Apr 2019 01:45:36 -0500 Subject: [PATCH 4/7] Downgrade pylint dependency from 2.3.0 to 1.9.4 for Python 2.7 --- requirements-dev.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements-dev.txt b/requirements-dev.txt index 9168e6f..6bf545f 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,5 +1,5 @@ coverage==4.4.1 nose==1.3.7 -pylint==2.3.0 +pylint==1.9.4 tox==2.8.2 twine==1.12.1 From fd11a2c5a0178b72407b0b9f7b6df68f2ceb789d Mon Sep 17 00:00:00 2001 From: Jose A Lerma III Date: Thu, 18 Apr 2019 23:29:02 -0500 Subject: [PATCH 5/7] Add docstring to test_windows_whitelist --- tests/test_halo.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_halo.py b/tests/test_halo.py index 23cb902..62781a3 100644 --- a/tests/test_halo.py +++ b/tests/test_halo.py @@ -552,6 +552,8 @@ def test_redirect_stdout(self): self.assertIn('foo', output[0]) def test_windows_whitelist(self): + """Test whitelist of Windows-compatible spinners + """ if is_supported(): pass else: From c4efabfb7fde200bce46adde9c889af5b1a76bad Mon Sep 17 00:00:00 2001 From: Jose A Lerma III Date: Thu, 18 Apr 2019 23:30:54 -0500 Subject: [PATCH 6/7] Refactored if statement in test_windows_whitelist --- tests/test_halo.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/test_halo.py b/tests/test_halo.py index 62781a3..8e92f0d 100644 --- a/tests/test_halo.py +++ b/tests/test_halo.py @@ -554,9 +554,7 @@ def test_redirect_stdout(self): def test_windows_whitelist(self): """Test whitelist of Windows-compatible spinners """ - if is_supported(): - pass - else: + if not is_supported(): instance = Halo() default_spinner_value = "line" From 6e0696bba39a67e1385a0b41e704f44c8b0709a3 Mon Sep 17 00:00:00 2001 From: Jose A Lerma III Date: Fri, 19 Apr 2019 01:31:25 -0500 Subject: [PATCH 7/7] Added frame test to test_windows_whitelist --- tests/test_halo.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_halo.py b/tests/test_halo.py index 8e92f0d..dde97c1 100644 --- a/tests/test_halo.py +++ b/tests/test_halo.py @@ -567,6 +567,17 @@ def test_windows_whitelist(self): instance.spinner = "monkey" self.assertEqual(default_spinner, instance.spinner) + spinner = Halo(text='foo', spinner='balloon2', stream=self._stream) + frames_ = [get_coded_text(frame_) for frame_ in Spinners['balloon2'].value['frames']] + + spinner.start() + time.sleep(1) + spinner.stop() + output = self._get_test_output()['text'] + + for i in range(len(frames_)): + self.assertEqual(output[i], '{0} foo'.format(frames_[i])) + def tearDown(self): pass