* doc/release:

Document having clean test run.
	* morituri/common/encode.py:
	  Catch and properly stop on gst.QueryError.
	  Don't set peak in stop if we had an error.
	* morituri/test/test_common_encode.py:
	* morituri/test/test_common_renamer.py:
	* morituri/test/test_image_cue.py:
	  Clean up after tests.
This commit is contained in:
Thomas Vander Stichele
2010-04-06 00:02:56 +00:00
parent f978907fcf
commit 98213c4196
6 changed files with 53 additions and 14 deletions

View File

@@ -1,3 +1,15 @@
2010-04-06 Thomas Vander Stichele <thomas at apestaart dot org>
* doc/release:
Document having clean test run.
* morituri/common/encode.py:
Catch and properly stop on gst.QueryError.
Don't set peak in stop if we had an error.
* morituri/test/test_common_encode.py:
* morituri/test/test_common_renamer.py:
* morituri/test/test_image_cue.py:
Clean up after tests.
2010-04-06 Thomas Vander Stichele <thomas at apestaart dot org>
* morituri/common/task.py:

View File

@@ -1,6 +1,11 @@
Release procedure for morituri
------------------------------
- Verify that all tests run.
- Verify that test run doesn't leave anything around in /tmp:
ls /tmp/*morituri*
- Verify that all buildbots are green.
- Pick a new version number and set it:
export VERSION=0.1.0
- Update configure.ac

View File

@@ -175,7 +175,13 @@ class EncodeTask(task.Task):
# get length
self.debug('query duration')
length, qformat = tagger.query_duration(gst.FORMAT_DEFAULT)
try:
length, qformat = tagger.query_duration(gst.FORMAT_DEFAULT)
except gst.QueryError, e:
self.setException(e)
self.stop()
return
# wavparse 0.10.14 returns in bytes
if qformat == gst.FORMAT_BYTES:
self.debug('query returned in BYTES format')
@@ -250,4 +256,5 @@ class EncodeTask(task.Task):
self.debug('set state to NULL')
task.Task.stop(self)
self.peak = math.sqrt(math.pow(10, self._peakdB / 10.0))
if self._peakdB:
self.peak = math.sqrt(math.pow(10, self._peakdB / 10.0))

View File

@@ -26,14 +26,16 @@ class PathTestCase(common.TestCase):
encodetask, verbose=False)
self.failUnless(isinstance(e.exception, gst.QueryError),
"%r is not a gst.QueryError" % e.exception)
os.close(fd)
os.unlink(path)
os.unlink(path + '.out')
def testUnicodePath(self):
# this test makes sure we can checksum a unicode path
self._testSuffix(u'morituri.test.B\xeate Noire.empty')
self._testSuffix(u'.morituri.test_encode.B\xeate Noire')
def testSingleQuote(self):
self._testSuffix(u"morituri.test.Guns 'N Roses")
self._testSuffix(u".morituri.test_encode.Guns 'N Roses")
def testDoubleQuote(self):
self._testSuffix(u'morituri.test.12" edit')
self._testSuffix(u'.morituri.test_encode.12" edit')

View File

@@ -10,7 +10,7 @@ from morituri.common import renamer
class RenameInFileTestcase(unittest.TestCase):
def setUp(self):
(fd, self._path) = tempfile.mkstemp(suffix='morituri')
(fd, self._path) = tempfile.mkstemp(suffix='.morituri.renamer.infile')
os.write(fd, 'This is a test\nThis is another\n')
os.close(fd)
@@ -25,6 +25,7 @@ class RenameInFileTestcase(unittest.TestCase):
o.do()
output = open(self._path).read()
self.assertEquals(output, 'That was some test\nThat was somenother\n')
os.unlink(self._path)
def testSerialize(self):
o = renamer.RenameInFile(self._path, 'is is a', 'at was some')
@@ -33,13 +34,15 @@ class RenameInFileTestcase(unittest.TestCase):
o2.do()
output = open(self._path).read()
self.assertEquals(output, 'That was some test\nThat was somenother\n')
os.unlink(self._path)
class RenameFileTestcase(unittest.TestCase):
def setUp(self):
(fd, self._source) = tempfile.mkstemp(suffix='morituri')
(fd, self._source) = tempfile.mkstemp(suffix='.morituri.renamer.file')
os.write(fd, 'This is a test\nThis is another\n')
os.close(fd)
(fd, self._destination) = tempfile.mkstemp(suffix='morituri')
(fd, self._destination) = tempfile.mkstemp(
suffix='.morituri.renamer.file')
os.close(fd)
os.unlink(self._destination)
self._operation = renamer.RenameFile(self._source, self._destination)
@@ -61,6 +64,7 @@ class RenameFileTestcase(unittest.TestCase):
self._operation.do()
output = open(self._destination).read()
self.assertEquals(output, 'This is a test\nThis is another\n')
os.unlink(self._destination)
def testSerialize(self):
data = self._operation.serialize()
@@ -68,16 +72,19 @@ class RenameFileTestcase(unittest.TestCase):
o.do()
output = open(self._destination).read()
self.assertEquals(output, 'This is a test\nThis is another\n')
os.unlink(self._destination)
class OperatorTestCase(unittest.TestCase):
def setUp(self):
self._statePath = tempfile.mkdtemp(suffix='.morituri')
self._statePath = tempfile.mkdtemp(suffix='.morituri.renamer.operator')
self._operator = renamer.Operator(self._statePath, 'test')
(fd, self._source) = tempfile.mkstemp(suffix='morituri')
(fd, self._source) = tempfile.mkstemp(
suffix='.morituri.renamer.operator')
os.write(fd, 'This is a test\nThis is another\n')
os.close(fd)
(fd, self._destination) = tempfile.mkstemp(suffix='morituri')
(fd, self._destination) = tempfile.mkstemp(
suffix='.morituri.renamer.operator')
os.close(fd)
os.unlink(self._destination)
self._operator.addOperation(
@@ -85,6 +92,9 @@ class OperatorTestCase(unittest.TestCase):
self._operator.addOperation(
renamer.RenameFile(self._source, self._destination))
def tearDown(self):
os.system('rm -rf %s' % self._statePath)
def testLoadNoneDone(self):
self._operator.save()
@@ -93,6 +103,7 @@ class OperatorTestCase(unittest.TestCase):
self.assertEquals(o._todo, self._operator._todo)
self.assertEquals(o._done, [])
os.unlink(self._source)
def testLoadOneDone(self):
self.assertEquals(len(self._operator._done), 0)
@@ -110,6 +121,7 @@ class OperatorTestCase(unittest.TestCase):
# now continue
o.next()
self.assertEquals(len(o._done), 2)
os.unlink(self._destination)
def testLoadOneInterrupted(self):
self.assertEquals(len(self._operator._done), 0)
@@ -132,3 +144,5 @@ class OperatorTestCase(unittest.TestCase):
self.assertEquals(len(o._done), 1)
o.next()
self.assertEquals(len(o._done), 2)
os.unlink(self._destination)

View File

@@ -51,7 +51,7 @@ class KanyeMixedTestCase(unittest.TestCase):
class WriteCueFileTestCase(unittest.TestCase):
def testWrite(self):
fd, path = tempfile.mkstemp(suffix=u'morituri.test.cue')
fd, path = tempfile.mkstemp(suffix=u'.morituri.test.cue')
os.close(fd)
it = table.Table()
@@ -78,5 +78,4 @@ FILE "track01.wav" WAVE
FILE "track02.wav" WAVE
INDEX 01 00:00:00
""")
os.unlink(path)