* introduce logcommand.Lager, Whipper(); use argparse for whipper image commands, stub logging * update Lager docstring to mention config.Config() * make incorrect subcommand and --version work on toplevel command * migrate accurip show, expand Lager, do not attempt to return from Lager.__init__. * migrate offset find, add Lager.error * correct offset find drive symlink handling * migrate drive * change Lager.__init__(prog) to arg from kwarg * but actually * remove Whipper.usage * add and use Lager.device_option() context manager * help I married an axe murderer * use unified options namespace for entire command tree * migrate whipper cd without comprehensive config loading * switch to logging module - use logging instead of flog for non-extern modules - use WHIPPER_DEBUG and WHIPPER_LOGFILE env variables * convert self.log calls to logger.debug * convert self.error calls to logger.error * remove log.Loggable, use logger not logging * Logging conversion continues - Convert log.* calls to logger.* - Remove morituri.common.log imports * remove morituri.common.log from tests * remove extern/flog, bare minimum Debug conversion * update README for logging changes * update soxi to use logging * refactor Lager for more declarative subcommands * Refactor Lager.device_option: - inline into __init__ - throw IOError instead of Exception for missing drives - remove CommandError checking in rip/main * rename rip to whipper in rip.main * convert rip.debug commands * Rename logcommand.Lager to command.BaseCommand - remove command.CommandError occurrences - remove python-command external module * remove submodules from README, update rclog formatter * update minor ambiguity in readme for command invocation * update version number to match setup.py * remove gitmodules * update version number in tests as well (boo) * convert logger.error to logger.critical * Change morituri.rip to morituri.command - mv common.command to command.basecommand - move TEMPLATES used only by rip.cd out of rip.common - update entry point for command to command.main * update basecommand documentation * go pyflaking: import fixing * replace self.stdout with sys.stdout * remove BaseCommand.config, alphabetise imports * convert self.stdXXX leftovers * convert last getRootCommand to config.Config * convert last getExceptionMessage's to str * change musicbrainz useragent to whipper
86 lines
2.9 KiB
Python
86 lines
2.9 KiB
Python
# -*- Mode: Python; test-case-name: morituri.test.test_image_image -*-
|
|
# vi:si:et:sw=4:sts=4:ts=4
|
|
|
|
import os
|
|
import tempfile
|
|
|
|
import gobject
|
|
gobject.threads_init()
|
|
|
|
import gst
|
|
|
|
from morituri.image import image
|
|
from morituri.common import common
|
|
|
|
from morituri.extern.task import task, gstreamer
|
|
|
|
from morituri.test import common as tcommon
|
|
|
|
|
|
def h(i):
|
|
return "0x%08x" % i
|
|
|
|
|
|
class TrackSingleTestCase(tcommon.TestCase):
|
|
|
|
def setUp(self):
|
|
self.image = image.Image(os.path.join(os.path.dirname(__file__),
|
|
u'track-single.cue'))
|
|
self.runner = task.SyncRunner(verbose=False)
|
|
self.image.setup(self.runner)
|
|
|
|
def testAccurateRipChecksum(self):
|
|
checksumtask = image.AccurateRipChecksumTask(self.image)
|
|
self.runner.run(checksumtask, verbose=False)
|
|
|
|
self.assertEquals(len(checksumtask.checksums), 4)
|
|
# self.assertEquals(h(checksumtask.checksums[0]), '0x00000000')
|
|
# self.assertEquals(h(checksumtask.checksums[1]), '0x793fa868')
|
|
# self.assertEquals(h(checksumtask.checksums[2]), '0x8dd37c26')
|
|
# self.assertEquals(h(checksumtask.checksums[3]), '0x00000000')
|
|
|
|
def testLength(self):
|
|
self.assertEquals(self.image.table.getTrackLength(1), 2)
|
|
self.assertEquals(self.image.table.getTrackLength(2), 2)
|
|
self.assertEquals(self.image.table.getTrackLength(3), 2)
|
|
self.assertEquals(self.image.table.getTrackLength(4), 4)
|
|
|
|
def testCDDB(self):
|
|
self.assertEquals(self.image.table.getCDDBDiscId(), "08000004")
|
|
|
|
def testAccurateRip(self):
|
|
self.assertEquals(self.image.table.getAccurateRipIds(), (
|
|
"00000016", "0000005b"))
|
|
|
|
|
|
class TrackSeparateTestCase(tcommon.TestCase):
|
|
|
|
def setUp(self):
|
|
self.image = image.Image(os.path.join(os.path.dirname(__file__),
|
|
u'track-separate.cue'))
|
|
self.runner = task.SyncRunner(verbose=False)
|
|
self.image.setup(self.runner)
|
|
|
|
def testAccurateRipChecksum(self):
|
|
checksumtask = image.AccurateRipChecksumTask(self.image)
|
|
self.runner.run(checksumtask, verbose=False)
|
|
|
|
self.assertEquals(len(checksumtask.checksums), 4)
|
|
self.assertEquals(h(checksumtask.checksums[0]), '0xd60e55e1')
|
|
self.assertEquals(h(checksumtask.checksums[1]), '0xd63dc2d2')
|
|
self.assertEquals(h(checksumtask.checksums[2]), '0xd63dc2d2')
|
|
self.assertEquals(h(checksumtask.checksums[3]), '0x7271db39')
|
|
|
|
def testLength(self):
|
|
self.assertEquals(self.image.table.getTrackLength(1), 10)
|
|
self.assertEquals(self.image.table.getTrackLength(2), 10)
|
|
self.assertEquals(self.image.table.getTrackLength(3), 10)
|
|
self.assertEquals(self.image.table.getTrackLength(4), 10)
|
|
|
|
def testCDDB(self):
|
|
self.assertEquals(self.image.table.getCDDBDiscId(), "08000004")
|
|
|
|
def testAccurateRip(self):
|
|
self.assertEquals(self.image.table.getAccurateRipIds(), (
|
|
"00000064", "00000191"))
|