[SCM] morituri/master: * morituri/common/checksum.py: Actually raise the exception. * morituri/common/task.py: Document interface more clearly. * morituri/test/test_common_checksum.py: Use tcommon for test.common

js at users.alioth.debian.org js at users.alioth.debian.org
Sun Oct 19 20:09:23 UTC 2014


The following commit has been merged in the master branch:
commit 0da5dd0aa1ac4b2f55689b8790415611ff5a093f
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date:   Sat May 21 11:22:04 2011 +0000

    	* morituri/common/checksum.py:
    	  Actually raise the exception.
    	* morituri/common/task.py:
    	  Document interface more clearly.
    	* morituri/test/test_common_checksum.py:
    	  Use tcommon for test.common

diff --git a/ChangeLog b/ChangeLog
index 5437466..8ed24f5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2011-05-21  Thomas Vander Stichele  <thomas at apestaart dot org>
+
+	* morituri/common/checksum.py:
+	  Actually raise the exception.
+	* morituri/common/task.py:
+	  Document interface more clearly.
+	* morituri/test/test_common_checksum.py:
+	  Use tcommon for test.common
+
 2011-05-19  Thomas Vander Stichele  <thomas at apestaart dot org>
 
 	* morituri/common/common.py:
diff --git a/morituri/common/checksum.py b/morituri/common/checksum.py
index c57af97..d525b89 100644
--- a/morituri/common/checksum.py
+++ b/morituri/common/checksum.py
@@ -74,6 +74,8 @@ class GstPipelineTask(task.Task):
 
         if not self.exception:
             self.paused()
+        else:
+            raise self.exception
 
     def getPipelineDesc(self):
         raise NotImplementedError
diff --git a/morituri/common/task.py b/morituri/common/task.py
index 0fc75d8..d2496f6 100644
--- a/morituri/common/task.py
+++ b/morituri/common/task.py
@@ -73,6 +73,13 @@ class Task(object, log.Loggable):
         Start the task.
 
         Subclasses should chain up to me at the beginning.
+
+        Subclass implementations should raise exceptions immediately in
+        case of failure (using set(AndRaise)Exception) first, or do it later
+        using those methods.
+
+        If start doesn't raise an exception, the task should run until
+        complete, or setException and stop().
         """
         self.debug('starting')
         self.setProgress(self.progress)
diff --git a/morituri/test/test_common_checksum.py b/morituri/test/test_common_checksum.py
index 6e802d7..07af930 100644
--- a/morituri/test/test_common_checksum.py
+++ b/morituri/test/test_common_checksum.py
@@ -11,14 +11,15 @@ import gst
 
 from morituri.test import common
 
-from morituri.common import task, checksum, log
+from morituri.common import task, checksum, log, common
+from morituri.image import image
 
-from morituri.test import common
+from morituri.test import common as tcommon
 
 def h(i):
     return "0x%08x" % i
 
-class EmptyTestCase(common.TestCase):
+class EmptyTestCase(tcommon.TestCase):
     def testEmpty(self):
         # this test makes sure that checksumming empty files doesn't hang
         self.runner = task.SyncRunner(verbose=False)
@@ -30,7 +31,7 @@ class EmptyTestCase(common.TestCase):
         self.failUnless(isinstance(e.exception, checksum.GstException))
         os.unlink(path)
 
-class PathTestCase(common.TestCase):
+class PathTestCase(tcommon.TestCase):
     def _testSuffix(self, suffix):
         self.runner = task.SyncRunner(verbose=False)
         fd, path = tempfile.mkstemp(suffix=suffix)
@@ -40,7 +41,7 @@ class PathTestCase(common.TestCase):
         self.failUnless(isinstance(e.exception, checksum.GstException))
         os.unlink(path)
 
-class UnicodePathTestCase(PathTestCase, common.UnicodeTestMixin):
+class UnicodePathTestCase(PathTestCase, tcommon.UnicodeTestMixin):
     def testUnicodePath(self):
         # this test makes sure we can checksum a unicode path
         self._testSuffix(u'morituri.test.B\xeate Noire.empty')

-- 
morituri packaging



More information about the pkg-multimedia-commits mailing list