From: david-sarah <david-sarah@jacaranda.org>
Date: Sun, 18 Jul 2010 03:03:33 +0000 (-0700)
Subject: test_encodingutil: fix test_open_representable, which is only valid when run on a... 
X-Git-Url: https://git.rkrishnan.org/simplejson/%5B/%5D%20/uri/provisioning?a=commitdiff_plain;h=bdb10553eb4a461cc561e22cb51f8efa65a32815;p=tahoe-lafs%2Ftahoe-lafs.git

test_encodingutil: fix test_open_representable, which is only valid when run on a platform for which we know an unrepresentable filename.
---

diff --git a/src/allmydata/test/test_encodingutil.py b/src/allmydata/test/test_encodingutil.py
index 9a3c5f33..dd22d0db 100644
--- a/src/allmydata/test/test_encodingutil.py
+++ b/src/allmydata/test/test_encodingutil.py
@@ -278,8 +278,13 @@ class StdlibUnicode(unittest.TestCase):
         if unicode_platform():
             raise unittest.SkipTest("This test is not applicable to platforms that represent filenames as Unicode.")
 
-        mock.return_value = 'ascii'
-        self.failUnlessRaises(UnicodeEncodeError, open, lumiere_nfc, 'rb')
+        enc = get_filesystem_encoding()
+        fn = u'\u2621.txt'
+        try:
+            fn.encode(enc)
+            raise unittest.SkipTest("This test cannot be run unless we know a filename that is not representable.")
+        except UnicodeEncodeError:
+            self.failUnlessRaises(UnicodeEncodeError, open, fn, 'wb')
 
 
 class UbuntuKarmicUTF8(EncodingUtil, unittest.TestCase):