]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
More Unicode test fixes.
authordavid-sarah <david-sarah@jacaranda.org>
Mon, 7 Jun 2010 05:33:58 +0000 (22:33 -0700)
committerdavid-sarah <david-sarah@jacaranda.org>
Mon, 7 Jun 2010 05:33:58 +0000 (22:33 -0700)
src/allmydata/test/test_cli.py
src/allmydata/test/test_stringutils.py

index 55fede26399c74c1d2965b2fcfb12f8745f48ff8..453eb50b3aded3f64f8592c19bac79ff2f24cbca 100644 (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
index 1d833004eb9702a525c19c30f5b40c7e023d0c9a..c66586b0a5fee2a89df9342ca7a5c8eb779d565b 100644 (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')