Files
whipper-gui/morituri/test/test_program_cdparanoia.py
Thomas Vander Stichele 4647d107a9 * morituri/program/cdparanoia.py:
* morituri/test/test_program_cdparanoia.py:
	  Add a task that can analyze the drive for whether it defeats
	  the audio cache.
	* morituri/result/result.py:
	* morituri/rip/cd.py:
	  Make it possible to store whether a drive defeats audio cache
	  in the result.
	* morituri/rip/drive.py:
	  Add rip drive analyze command to analyze caching of a drive,
	  and store it in the config.
2012-12-04 00:14:42 +00:00

75 lines
1.9 KiB
Python

# -*- Mode: Python; test-case-name: morituri.test.test_program_cdparanoia -*-
# vi:si:et:sw=4:sts=4:ts=4
import os
from morituri.extern.task import task
from morituri.program import cdparanoia
from morituri.test import common
class ParseTestCase(common.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(common.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, '79.6 %')
class VersionTestCase(common.TestCase):
def testGetVersion(self):
self.failUnless(cdparanoia.getCdParanoiaVersion())
class AnalyzeFileTask(cdparanoia.AnalyzeTask):
def __init__(self, path):
self.command = ['cat', path]
def readbytesout(self, bytes):
self.readbyteserr(bytes)
class CacheTestCase(common.TestCase):
def testDefeatsCache(self):
self.runner = task.SyncRunner(verbose=False)
path = os.path.join(os.path.dirname(__file__),
'cdparanoia', 'PX-L890SA.cdparanoia-A.stderr')
t = AnalyzeFileTask(path)
self.runner.run(t)
self.failUnless(t.defeatsCache)