Files
whipper-gui/morituri/test/test_program_cdparanoia.py
Thomas Vander Stichele f8409b29e1 * morituri/program/cdparanoia.py:
cdparanoia can hang indefinitely on scsi read errors.
	  For example, on some drives, when trying negative offsets.
	  Notice them, count them, and fail after 100.
	* morituri/test/test_program_cdparanoia.py:
	* morituri/test/cdparanoia.progress.error (added):
	  Add a test for this output.
2011-03-23 19:40:47 +00:00

43 lines
1.2 KiB
Python

# -*- Mode: Python; test-case-name: morituri.test.test_program_cdparanoia -*-
# vi:si:et:sw=4:sts=4:ts=4
import os
import unittest
from morituri.program import cdparanoia
class ParseTestCase(unittest.TestCase):
def setUp(self):
# report from Afghan Whigs - Sweet Son Of A Bitch
path = os.path.join(os.path.dirname(__file__),
'cdparanoia.progress')
self._parser = cdparanoia.ProgressParser(start=45990, stop=47719)
self._handle = open(path)
def testParse(self):
for line in self._handle.readlines():
self._parser.parse(line)
q = '%.01f %%' % (self._parser.getTrackQuality() * 100.0, )
self.assertEquals(q, '99.7 %')
class ErrorTestCase(unittest.TestCase):
def setUp(self):
# report from a rip with offset -1164 causing scsi errors
path = os.path.join(os.path.dirname(__file__),
'cdparanoia.progress.error')
self._parser = cdparanoia.ProgressParser(start=0, stop=10800)
self._handle = open(path)
def testParse(self):
for line in self._handle.readlines():
self._parser.parse(line)
q = '%.01f %%' % (self._parser.getTrackQuality() * 100.0, )
self.assertEquals(q, '99.7 %')