* 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
This commit is contained in:
Thomas Vander Stichele
2011-05-21 11:22:04 +00:00
parent 019ad538d8
commit 0da5dd0aa1
4 changed files with 24 additions and 5 deletions

View File

@@ -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:

View File

@@ -74,6 +74,8 @@ class GstPipelineTask(task.Task):
if not self.exception:
self.paused()
else:
raise self.exception
def getPipelineDesc(self):
raise NotImplementedError

View File

@@ -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)

View File

@@ -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')