Skip to content

Commit

Permalink
Merge pull request #41 from mogproject/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
mogproject committed Jan 14, 2015
2 parents 659ff83 + f9d073e commit 1e8f060
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 20 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ Dependencies
* Python >= 2.6
* pytz
* python-dateutil
* GitPython
* GitPython >= 0.3.5
* boto
* moto (for testing)

Expand Down
2 changes: 1 addition & 1 deletion src/artifactcli/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.1.8"
__version__ = "0.1.9"
18 changes: 1 addition & 17 deletions src/artifactcli/util/progressbar.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import sys
import threading
from Queue import Queue


class ProgressBar(object):
Expand All @@ -16,13 +15,12 @@ def __init__(self, interval=1, fp=sys.stdout):
"""
self.interval = interval
self.fp = fp
self.ex_queue = Queue() # store all exceptions raised in thread

# create event for handling termination
self.__stop_event = threading.Event()

# create and start new thread
self.thread = threading.Thread(target=lambda: self.__capture_exceptions(self.__target))
self.thread = threading.Thread(target=self.__target)
self.thread.start()

def stop(self):
Expand All @@ -34,20 +32,6 @@ def stop(self):
self.fp.write('\n')
self.fp.flush()

# check thread's exceptions
if not self.ex_queue.empty():
raise self.ex_queue.get_nowait()

def __capture_exceptions(self, f):
"""
Wrapper function to capture all exceptions which are raised in the thread
"""
try:
f()
except Exception as e:
self.ex_queue.put(e)
raise e

def __target(self):
"""
Inner method for writing dots in the separated thread
Expand Down
1 change: 0 additions & 1 deletion tests/artifactcli/util/test_progressbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,4 @@ def test_progress_bar_io_error(self):
time.sleep(1)
fp.close()
time.sleep(1)

self.assertRaises(ValueError, p.stop)

0 comments on commit 1e8f060

Please sign in to comment.