mirror of
https://github.com/tahoe-lafs/tahoe-lafs.git
synced 2025-02-21 10:01:54 +00:00
test_cli.py: remove invalid 'test_listdir_unicode_bad' test.
This commit is contained in:
parent
71f8757bd1
commit
3c883e6e44
@ -32,7 +32,7 @@ from twisted.python import usage
|
||||
from allmydata.util.assertutil import precondition
|
||||
from allmydata.util.stringutils import listdir_unicode, open_unicode, unicode_platform, \
|
||||
quote_output, get_output_encoding, get_argv_encoding, get_filesystem_encoding, \
|
||||
unicode_to_output, FilenameEncodingError
|
||||
unicode_to_output
|
||||
|
||||
timeout = 480 # deep_check takes 360s on Zandr's linksys box, others take > 240s
|
||||
|
||||
@ -443,35 +443,6 @@ class CLI(CLITestMixin, unittest.TestCase):
|
||||
for file in listdir_unicode(unicode(basedir)):
|
||||
self.failUnlessIn(file, filenames)
|
||||
|
||||
def test_listdir_unicode_bad(self):
|
||||
basedir = "cli/common/listdir_unicode_bad"
|
||||
fileutil.make_dirs(basedir)
|
||||
|
||||
filenames = [name.encode('latin1') for name in [u'Lôzane', u'Bern', u'Genève']]
|
||||
enc = get_filesystem_encoding()
|
||||
def is_decodable(u):
|
||||
try:
|
||||
u.decode(enc)
|
||||
return True
|
||||
except UnicodeDecodeError:
|
||||
return False
|
||||
|
||||
if all(map(is_decodable, filenames)):
|
||||
raise unittest.SkipTest("To perform this test, we must know a filename that is "
|
||||
"not decodable in the platform's filesystem encoding.")
|
||||
|
||||
try:
|
||||
for name in filenames:
|
||||
path = os.path.join(basedir, name)
|
||||
open(path, "wb").close()
|
||||
except EnvironmentError:
|
||||
# Maybe the OS or Python wouldn't let us create a file at the badly encoded path,
|
||||
# which is entirely reasonable.
|
||||
raise unittest.SkipTest("This test is only applicable to platforms that allow "
|
||||
"creating files at badly encoded paths.")
|
||||
|
||||
self.failUnlessRaises(FilenameEncodingError, listdir_unicode, unicode(basedir))
|
||||
|
||||
|
||||
class Help(unittest.TestCase):
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user