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

This commit is contained in:
david-sarah 2010-07-17 20:03:33 -07:00
parent 968edfda11
commit bdb10553eb
1 changed files with 7 additions and 2 deletions

View File

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