[Python-checkins] cpython (2.7): Limit test scope to those platforms that can save the target filenames.
jason.coombs
python-checkins at python.org
Wed Dec 28 17:42:38 CET 2011
http://hg.python.org/cpython/rev/9b681e0c04ed
changeset: 74191:9b681e0c04ed
branch: 2.7
parent: 74185:e71e4bd45c89
user: Jason R. Coombs <jaraco at jaraco.com>
date: Wed Dec 28 11:42:22 2011 -0500
summary:
Limit test scope to those platforms that can save the target filenames. Reference #11638.
files:
Lib/distutils/tests/test_archive_util.py | 17 ++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/Lib/distutils/tests/test_archive_util.py b/Lib/distutils/tests/test_archive_util.py
--- a/Lib/distutils/tests/test_archive_util.py
+++ b/Lib/distutils/tests/test_archive_util.py
@@ -4,6 +4,7 @@
import unittest
import os
+import sys
import tarfile
from os.path import splitdrive
import warnings
@@ -34,6 +35,18 @@
except ImportError:
zlib = None
+def can_fs_encode(filename):
+ """
+ Return True if the filename can be saved in the file system.
+ """
+ if os.path.supports_unicode_filenames:
+ return True
+ try:
+ filename.encode(sys.getfilesystemencoding())
+ except UnicodeEncodeError:
+ return False
+ return True
+
class ArchiveUtilTestCase(support.TempdirManager,
support.LoggingSilencer,
@@ -289,6 +302,8 @@
self._make_tarball(u'archive')
@unittest.skipUnless(zlib, "requires zlib")
+ @unittest.skipUnless(can_fs_encode(u'årchiv'),
+ 'File system cannot handle this filename')
def test_make_tarball_unicode_latin1(self):
"""
Mirror test_make_tarball, except filename is unicode and contains
@@ -297,6 +312,8 @@
self._make_tarball(u'årchiv') # note this isn't a real word
@unittest.skipUnless(zlib, "requires zlib")
+ @unittest.skipUnless(can_fs_encode(u'のアーカイブ'),
+ 'File system cannot handle this filename')
def test_make_tarball_unicode_extended(self):
"""
Mirror test_make_tarball, except filename is unicode and contains
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list