* 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.
This commit is contained in:
Thomas Vander Stichele
2010-04-17 23:07:57 +00:00
parent 0db1c45bfc
commit 171621d06c
8 changed files with 61 additions and 20 deletions

View File

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