[SCM] morituri/master: read cue and substitute current version to make tests pass
js at users.alioth.debian.org
js at users.alioth.debian.org
Sun Oct 19 20:10:16 UTC 2014
The following commit has been merged in the master branch:
commit 5b0ca8526d4820446ea8d2d0cf3e941a037c0e3a
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date: Mon May 26 15:39:58 2014 -0400
read cue and substitute current version to make tests pass
diff --git a/morituri/test/common.py b/morituri/test/common.py
index 955db36..aebf004 100644
--- a/morituri/test/common.py
+++ b/morituri/test/common.py
@@ -1,6 +1,7 @@
# -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4
+import re
import os
import sys
@@ -8,6 +9,7 @@ import sys
from twisted.trial import unittest
from morituri.common import log
+from morituri.configure import configure
log.init()
@@ -63,6 +65,19 @@ class TestCase(log.Loggable, unittest.TestCase):
assertRaises = failUnlessRaises
+ def readCue(self, name):
+ """
+ Read a .cue file, and replace the version comment with the current
+ version so we can use it in comparisons.
+ """
+ ret = open(os.path.join(os.path.dirname(__file__), name)).read(
+ ).decode('utf-8')
+ ret = re.sub(
+ 'REM COMMENT "Morituri.*',
+ 'REM COMMENT "Morituri %s"' % (configure.version),
+ ret, re.MULTILINE)
+
+ return ret
class UnicodeTestMixin:
# A helper mixin to skip tests if we're not in a UTF-8 locale
diff --git a/morituri/test/test_image_toc.py b/morituri/test/test_image_toc.py
index 998bc0a..7fe79bc 100644
--- a/morituri/test/test_image_toc.py
+++ b/morituri/test/test_image_toc.py
@@ -88,8 +88,7 @@ class CureTestCase(common.TestCase):
def testConvertCue(self):
# self.toc.table.absolutize()
cue = self.toc.table.cue()
- ref = open(os.path.join(os.path.dirname(__file__), 'cure.cue')).read(
- ).decode('utf-8')
+ ref = self.readCue('cure.cue')
common.diffStrings(ref, cue)
# we verify it because it has failed in readdisc in the past
@@ -159,8 +158,7 @@ class BlocTestCase(common.TestCase):
#self.toc.table.absolutize()
self.failUnless(self.toc.table.hasTOC())
cue = self.toc.table.cue()
- ref = open(os.path.join(os.path.dirname(__file__),
- 'bloc.cue')).read().decode('utf-8')
+ ref = self.readCue('bloc.cue')
common.diffStrings(ref, cue)
def testCDDBId(self):
@@ -204,8 +202,7 @@ class BreedersTestCase(common.TestCase):
# self.toc.table.absolutize()
self.failUnless(self.toc.table.hasTOC())
cue = self.toc.table.cue()
- ref = open(os.path.join(os.path.dirname(__file__),
- 'breeders.cue')).read()
+ ref = self.readCue('breeders.cue')
self.assertEquals(cue, ref)
# Ladyhawke has a data track
--
morituri packaging
More information about the pkg-multimedia-commits
mailing list