More Unicode test fixes.

This commit is contained in:
david-sarah 2010-06-06 22:33:58 -07:00
parent 65b6f4e3ce
commit 529c9f673a
2 changed files with 13 additions and 7 deletions

View File

@ -1067,12 +1067,12 @@ class List(GridTestMixin, CLITestMixin, unittest.TestCase):
if good_out is None:
self.failUnlessReallyEqual(rc, 1)
self.failUnlessIn("files whose names could not be converted", err)
self.failUnlessReallyEqual(out, "")
self.failUnlessIn(quote_output(u"gööd"), err)
self.failUnlessReallyEqual(sorted(out.splitlines()), sorted(["0share", "1share"]))
else:
self.failUnlessReallyEqual(rc, 0)
self.failUnlessReallyEqual(err, "")
outstrs = out.splitlines()
self.failUnlessReallyEqual(outstrs, ["0share", "1share", good_out])
self.failUnlessReallyEqual(sorted(out.splitlines()), sorted(["0share", "1share", good_out]))
d.addCallback(_check1)
d.addCallback(lambda ign: self.do_cli("ls", "missing"))
def _check2((rc,out,err)):
@ -1095,6 +1095,7 @@ class List(GridTestMixin, CLITestMixin, unittest.TestCase):
if good_out is None:
self.failUnlessReallyEqual(rc, 1)
self.failUnlessIn("files whose names could not be converted", err)
self.failUnlessIn(quote_output(u"gööd"), err)
self.failUnlessReallyEqual(out, "")
else:
# listing a file (as dir/filename) should have the edge metadata,
@ -1130,8 +1131,7 @@ class List(GridTestMixin, CLITestMixin, unittest.TestCase):
def _check1_ascii((rc,out,err)):
self.failUnlessReallyEqual(rc, 0)
self.failUnlessReallyEqual(err, "")
outstrs = out.splitlines()
self.failUnlessReallyEqual(outstrs, ["0share", "1share", "good"])
self.failUnlessReallyEqual(sorted(out.splitlines()), sorted(["0share", "1share", "good"]))
d.addCallback(_check1_ascii)
def _check4_ascii((rc, out, err)):
# listing a file (as dir/filename) should have the edge metadata,
@ -1840,7 +1840,7 @@ class Backup(GridTestMixin, CLITestMixin, StallMixin, unittest.TestCase):
def _check((rc, out, err)):
self.failUnlessReallyEqual(rc, 2)
foo2 = os.path.join(source, "foo2.txt")
self.failUnlessReallyEqual(err, "WARNING: cannot backup symlink %s\n" % foo2)
self.failUnlessReallyEqual(err, "WARNING: cannot backup symlink '%s'\n" % foo2)
fu, fr, fs, dc, dr, ds = self.count_output(out)
# foo.txt

View File

@ -205,7 +205,7 @@ class StringUtils(ReallyEqualMixin):
try:
u"test".encode(self.filesystem_encoding)
except UnicodeEncodeError:
except LookupError:
raise unittest.SkipTest("This platform does not support the '%s' filesystem encoding "
"that we are testing for the benefit of a different platform.")
@ -225,6 +225,12 @@ class StringUtils(ReallyEqualMixin):
mock_getfilesystemencoding.return_value = self.filesystem_encoding
fn = u'/dummy_directory/lumière.txt'
try:
u"test".encode(self.filesystem_encoding)
except LookupError:
raise unittest.SkipTest("This platform does not support the '%s' filesystem encoding "
"that we are testing for the benefit of a different platform.")
_reload()
try:
open_unicode(fn, 'rb')