[SCM] morituri/master: * morituri/test/Makefile.am: * morituri/test/jose.toc (added): * morituri/test/JoséGonzález.toc (deleted): Rename utf-8 file to a normal file. * morituri/test/common.py: * morituri/test/test_common_checksum.py: * morituri/test/test_common_encode.py: * morituri/test/test_image_image.py: * morituri/test/test_image_toc.py: Copy the normal file first to the utf-8 filename, if supported. Skip tests that need unicode when we are not in a utf-8 locale.
js at users.alioth.debian.org
js at users.alioth.debian.org
Sun Oct 19 20:09:19 UTC 2014
The following commit has been merged in the master branch:
commit 171621d06c307883c8d7530100a9939250539e14
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date: Sat Apr 17 23:07:57 2010 +0000
* morituri/test/Makefile.am:
* morituri/test/jose.toc (added):
* morituri/test/JoséGonzález.toc (deleted):
Rename utf-8 file to a normal file.
* morituri/test/common.py:
* morituri/test/test_common_checksum.py:
* morituri/test/test_common_encode.py:
* morituri/test/test_image_image.py:
* morituri/test/test_image_toc.py:
Copy the normal file first to the utf-8 filename, if supported.
Skip tests that need unicode when we are not in a utf-8 locale.
diff --git a/ChangeLog b/ChangeLog
index d3fd2c9..795e863 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2010-04-18 Thomas Vander Stichele <thomas at apestaart dot org>
+
+ * morituri/test/Makefile.am:
+ * morituri/test/jose.toc (added):
+ * morituri/test/JoséGonzález.toc (deleted):
+ Rename utf-8 file to a normal file.
+ * morituri/test/common.py:
+ * morituri/test/test_common_checksum.py:
+ * morituri/test/test_common_encode.py:
+ * morituri/test/test_image_image.py:
+ * morituri/test/test_image_toc.py:
+ Copy the normal file first to the utf-8 filename, if supported.
+ Skip tests that need unicode when we are not in a utf-8 locale.
+
2010-04-17 Thomas Vander Stichele <thomas at apestaart dot org>
* configure.ac:
diff --git a/morituri/test/Makefile.am b/morituri/test/Makefile.am
index 0c73b52..5d989f1 100644
--- a/morituri/test/Makefile.am
+++ b/morituri/test/Makefile.am
@@ -22,7 +22,7 @@ EXTRA_DIST = \
capital.2.toc \
cure.cue \
cure.toc \
- JoséGonzález.toc \
+ jose.toc \
dBAR-011-0010e284-009228a3-9809ff0b.bin \
dBAR-020-002e5023-029d8e49-040eaa14.bin \
kanye.cue \
diff --git a/morituri/test/common.py b/morituri/test/common.py
index 3d3c020..e28057f 100644
--- a/morituri/test/common.py
+++ b/morituri/test/common.py
@@ -1,8 +1,11 @@
# -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4
+import os
import sys
-import unittest
+
+# twisted's unittests have skip support, standard unittest don't
+from twisted.trial import unittest
from morituri.common import log
@@ -53,3 +56,13 @@ class TestCase(unittest.TestCase):
% (exception.__name__, result))
assertRaises = failUnlessRaises
+
+class UnicodeTestMixin:
+ # A helper mixin to skip tests if we're not in a UTF-8 locale
+ try:
+ os.stat(u'morituri.test.B\xeate Noire.empty')
+ except UnicodeEncodeError:
+ skip = 'No UTF-8 locale'
+ except OSError:
+ pass
+
diff --git "a/morituri/test/Jos\303\251Gonz\303\241lez.toc" b/morituri/test/jose.toc
similarity index 100%
rename from "morituri/test/Jos\303\251Gonz\303\241lez.toc"
rename to morituri/test/jose.toc
diff --git a/morituri/test/test_common_checksum.py b/morituri/test/test_common_checksum.py
index 8939c7a..d32b9d0 100644
--- a/morituri/test/test_common_checksum.py
+++ b/morituri/test/test_common_checksum.py
@@ -40,10 +40,12 @@ class PathTestCase(common.TestCase):
self.failUnless(isinstance(e.exception, gst.QueryError))
os.unlink(path)
+class UnicodePathTestCase(PathTestCase, common.UnicodeTestMixin):
def testUnicodePath(self):
# this test makes sure we can checksum a unicode path
self._testSuffix(u'morituri.test.B\xeate Noire.empty')
+class NormalPathTestCase(PathTestCase):
def testSingleQuote(self):
self._testSuffix(u"morituri.test.Guns 'N Roses")
diff --git a/morituri/test/test_common_encode.py b/morituri/test/test_common_encode.py
index 0549f5a..675b6bb 100644
--- a/morituri/test/test_common_encode.py
+++ b/morituri/test/test_common_encode.py
@@ -13,8 +13,6 @@ from morituri.test import common
from morituri.common import task, encode, log
-from morituri.test import common
-
class PathTestCase(common.TestCase):
def _testSuffix(self, suffix):
self.runner = task.SyncRunner(verbose=False)
@@ -30,10 +28,12 @@ class PathTestCase(common.TestCase):
os.unlink(path)
os.unlink(path + '.out')
+class UnicodePathTestCase(PathTestCase, common.UnicodeTestMixin):
def testUnicodePath(self):
# this test makes sure we can checksum a unicode path
self._testSuffix(u'.morituri.test_encode.B\xeate Noire')
+class NormalPathTestCase(PathTestCase):
def testSingleQuote(self):
self._testSuffix(u".morituri.test_encode.Guns 'N Roses")
diff --git a/morituri/test/test_image_image.py b/morituri/test/test_image_image.py
index f52ace0..392a660 100644
--- a/morituri/test/test_image_image.py
+++ b/morituri/test/test_image_image.py
@@ -3,7 +3,6 @@
import os
import tempfile
-import unittest
import gobject
gobject.threads_init()
@@ -19,7 +18,7 @@ log.init()
def h(i):
return "0x%08x" % i
-class TrackSingleTestCase(unittest.TestCase):
+class TrackSingleTestCase(tcommon.TestCase):
def setUp(self):
self.image = image.Image(os.path.join(os.path.dirname(__file__),
u'track-single.cue'))
@@ -49,7 +48,7 @@ class TrackSingleTestCase(unittest.TestCase):
self.assertEquals(self.image.table.getAccurateRipIds(), (
"00000016", "0000005b"))
-class TrackSeparateTestCase(unittest.TestCase):
+class TrackSeparateTestCase(tcommon.TestCase):
def setUp(self):
self.image = image.Image(os.path.join(os.path.dirname(__file__),
u'track-separate.cue'))
@@ -79,7 +78,7 @@ class TrackSeparateTestCase(unittest.TestCase):
self.assertEquals(self.image.table.getAccurateRipIds(), (
"00000064", "00000191"))
-class AudioLengthTestCase(unittest.TestCase):
+class AudioLengthTestCase(tcommon.TestCase):
def testLength(self):
path = os.path.join(os.path.dirname(__file__), u'track.flac')
t = image.AudioLengthTask(path)
@@ -101,10 +100,7 @@ class AudioLengthPathTestCase(tcommon.TestCase):
self.assertEquals(e.exception.code, gst.STREAM_ERROR_TYPE_NOT_FOUND)
os.unlink(path)
- def testUnicodePath(self):
- # this test makes sure we can checksum a unicode path
- self._testSuffix(u'morituri.test.B\xeate Noire.empty')
-
+class NormalAudioLengthPathTestCase(AudioLengthPathTestCase):
def testSingleQuote(self):
self._testSuffix(u"morituri.test.Guns 'N Roses")
@@ -112,3 +108,9 @@ class AudioLengthPathTestCase(tcommon.TestCase):
# This test makes sure we can checksum files with double quote in
# their name
self._testSuffix(u'morituri.test.12" edit')
+
+class UnicodeAudioLengthPathTestCase(AudioLengthPathTestCase, tcommon.UnicodeTestMixin):
+ def testUnicodePath(self):
+ # this test makes sure we can checksum a unicode path
+ self._testSuffix(u'morituri.test.B\xeate Noire.empty')
+
diff --git a/morituri/test/test_image_toc.py b/morituri/test/test_image_toc.py
index cee03ba..461f9ce 100644
--- a/morituri/test/test_image_toc.py
+++ b/morituri/test/test_image_toc.py
@@ -3,13 +3,14 @@
import os
import copy
-import unittest
+import shutil
+import tempfile
from morituri.image import toc
from morituri.test import common
-class CureTestCase(unittest.TestCase):
+class CureTestCase(common.TestCase):
def setUp(self):
self.toc = toc.TocFile(os.path.join(os.path.dirname(__file__),
u'cure.toc'))
@@ -90,7 +91,7 @@ class CureTestCase(unittest.TestCase):
'3/c/4/dBAR-013-0019d4c3-00fe8924-b90c650d.bin')
# Bloc Party - Silent Alarm has a Hidden Track One Audio
-class BlocTestCase(unittest.TestCase):
+class BlocTestCase(common.TestCase):
def setUp(self):
self.toc = toc.TocFile(os.path.join(os.path.dirname(__file__),
u'bloc.toc'))
@@ -137,7 +138,7 @@ class BlocTestCase(unittest.TestCase):
'e/d/2/dBAR-013-001af2de-0105994e-ad0be00d.bin')
# The Breeders - Mountain Battles has CDText
-class BreedersTestCase(unittest.TestCase):
+class BreedersTestCase(common.TestCase):
def setUp(self):
self.toc = toc.TocFile(os.path.join(os.path.dirname(__file__),
u'breeders.toc'))
@@ -163,7 +164,7 @@ class BreedersTestCase(unittest.TestCase):
self.assertEquals(cue, ref)
# Ladyhawke has a data track
-class LadyhawkeTestCase(unittest.TestCase):
+class LadyhawkeTestCase(common.TestCase):
def setUp(self):
self.toc = toc.TocFile(os.path.join(os.path.dirname(__file__),
u'ladyhawke.toc'))
@@ -179,7 +180,7 @@ class LadyhawkeTestCase(unittest.TestCase):
# c60af50d 13 150 15687 31841 51016 66616 81352 99559 116070 133243
# 149997 161710 177832 207256 2807
-class CapitalMergeTestCase(unittest.TestCase):
+class CapitalMergeTestCase(common.TestCase):
def setUp(self):
self.toc1 = toc.TocFile(os.path.join(os.path.dirname(__file__),
u'capital.1.toc'))
@@ -208,14 +209,23 @@ class CapitalMergeTestCase(unittest.TestCase):
self.assertEquals(self.table.getMusicBrainzDiscId(),
"MAj3xXf6QMy7G.BIFOyHyq4MySE-")
-class UnicodeTestCase(unittest.TestCase):
+class UnicodeTestCase(common.TestCase, common.UnicodeTestMixin):
def setUp(self):
+ # we copy the normal non-utf8 filename to a utf-8 filename
+ # in this test because builds with LANG=C fail if we include
+ # utf-8 filenames in the dist
path = u'Jos\xe9Gonz\xe1lez.toc'
self._performer = u'Jos\xe9 Gonz\xe1lez'
- self.toc = toc.TocFile(os.path.join(os.path.dirname(__file__), path))
+ source = os.path.join(os.path.dirname(__file__), 'jose.toc')
+ self.dest = os.path.join(os.path.dirname(__file__), path)
+ shutil.copy(source, self.dest)
+ self.toc = toc.TocFile(self.dest)
self.toc.parse()
self.assertEquals(len(self.toc.table.tracks), 10)
+ def tearDown(self):
+ os.unlink(self.dest)
+
def testGetTrackLength(self):
t = self.toc.table.tracks[0]
# first track has known length because the .toc is a single file
--
morituri packaging
More information about the pkg-multimedia-commits
mailing list