[SCM] morituri/master: * 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.

js at users.alioth.debian.org js at users.alioth.debian.org
Sun Oct 19 20:08:48 UTC 2014


The following commit has been merged in the master branch:
commit 837005d56586420e118d1bc16cef2cfad061a729
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date:   Sat Apr 25 10:02:51 2009 +0000

    	* 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.

diff --git a/ChangeLog b/ChangeLog
index 798d0e5..07e5ad4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 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:
 	  Fix name.
 
diff --git a/morituri/common/task.py b/morituri/common/task.py
index 5d909ac..0eb25ef 100644
--- a/morituri/common/task.py
+++ b/morituri/common/task.py
@@ -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()
diff --git a/morituri/test/test_image_image.py b/morituri/test/test_image_image.py
index 7571147..71c6a9b 100644
--- a/morituri/test/test_image_image.py
+++ b/morituri/test/test_image_image.py
@@ -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):

-- 
morituri packaging



More information about the pkg-multimedia-commits mailing list