From bdb10553eb4a461cc561e22cb51f8efa65a32815 Mon Sep 17 00:00:00 2001 From: david-sarah Date: Sat, 17 Jul 2010 20:03:33 -0700 Subject: [PATCH] test_encodingutil: fix test_open_representable, which is only valid when run on a platform for which we know an unrepresentable filename. --- src/allmydata/test/test_encodingutil.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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): -- 2.45.2