Skip to content

Commit

Permalink
Added a test that passes after the fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ushpizin committed Aug 10, 2019
1 parent 190b962 commit 41d9700
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/test_halo.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,23 @@ def test_closing_stream_before_stopping(self):
except ValueError as e:
self.fail('Attempted to write to a closed stream: {}'.format(e))

def test_closing_stream_before_persistent(self):
"""Test no I/O is performed on streams closed before stop_and_persist is called
"""
stream = io.StringIO()
spinner = Halo(text='foo', stream=stream)
spinner.start()
time.sleep(0.5)

# no exception raised after closing the stream means test was successful
try:
stream.close()

time.sleep(0.5)
spinner.stop_and_persist('done')
except ValueError as e:
self.fail('Attempted to write to a closed stream: {}'.format(e))

def test_setting_enabled_property(self):
"""Test if spinner stops writing when enabled property set to False
"""
Expand Down

0 comments on commit 41d9700

Please sign in to comment.