read cue and substitute current version to make tests pass

This commit is contained in:
Thomas Vander Stichele
2014-05-26 15:39:58 -04:00
parent f5fac325d2
commit 5b0ca8526d
2 changed files with 18 additions and 6 deletions

View File

@@ -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