* morituri/common/task.py:

Allow a SyncRunner to be constructed with verbose too.
	  Separate a 'running' verbose mode from that.
	  Fixes unwanted test output.
	* morituri/test/test_image_image.py:
	  Run without verbosity.
This commit is contained in:
Thomas Vander Stichele
2009-04-25 10:02:51 +00:00
parent a4cb2cfe42
commit 837005d565
3 changed files with 21 additions and 6 deletions

View File

@@ -1,3 +1,12 @@
2009-04-25 Thomas Vander Stichele <thomas at apestaart dot org>
* morituri/common/task.py:
Allow a SyncRunner to be constructed with verbose too.
Separate a 'running' verbose mode from that.
Fixes unwanted test output.
* morituri/test/test_image_image.py:
Run without verbosity.
2009-04-25 Thomas Vander Stichele <thomas at apestaart dot org>
* morituri/test/test_image_image.py:

View File

@@ -203,7 +203,7 @@ class MultiCombinedTask(BaseMultiTask):
self.setProgress(float(self._stopped) / len(self.tasks))
BaseMultiTask.stopped(self, task)
class TaskRunner:
class TaskRunner(object):
"""
I am a base class for task runners.
Task runners should be reusable.
@@ -261,9 +261,14 @@ class SyncRunner(TaskRunner):
"""
I run the task synchronously in a gobject MainLoop.
"""
def run(self, task, verbose=True, skip=False):
self._task = task
def __init__(self, verbose=True):
self._verbose = verbose
def run(self, task, verbose=None, skip=False):
self._task = task
self._verboseRun = self._verbose
if verbose is not None:
self._verboseRun = verbose
self._skip = skip
self._loop = gobject.MainLoop()
@@ -280,7 +285,7 @@ class SyncRunner(TaskRunner):
gobject.timeout_add(int(delta * 1000L), c)
def progressed(self, task, value):
if not self._verbose:
if not self._verboseRun:
return
self._report()
@@ -296,7 +301,8 @@ class SyncRunner(TaskRunner):
sys.stdout.write("%s\r" % (' ' * len(text), ))
def described(self, task, description):
self._report()
if self._verboseRun:
self._report()
def stopped(self, task):
self._loop.quit()

View File

@@ -47,7 +47,7 @@ class TrackSeparateTestCase(unittest.TestCase):
def setUp(self):
self.image = image.Image(os.path.join(os.path.dirname(__file__),
'track-separate.cue'))
self.runner = task.SyncRunner()
self.runner = task.SyncRunner(verbose=False)
self.image.setup(self.runner)
def testAccurateRipChecksum(self):