summaryrefslogtreecommitdiffstats
path: root/Lib/distutils
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2011-12-28 16:42:22 (GMT)
committerJason R. Coombs <jaraco@jaraco.com>2011-12-28 16:42:22 (GMT)
commit79e50c659ab769acad641117671a34ebcd7c53d9 (patch)
tree7c04d649e1caff01218e4e308285098e6abd5d3a /Lib/distutils
parentc32d5cb9ec1182870c20ef794d29b24ce4ee79e8 (diff)
downloadcpython-79e50c659ab769acad641117671a34ebcd7c53d9.zip
cpython-79e50c659ab769acad641117671a34ebcd7c53d9.tar.gz
cpython-79e50c659ab769acad641117671a34ebcd7c53d9.tar.bz2
Limit test scope to those platforms that can save the target filenames. Reference #11638.
Diffstat (limited to 'Lib/distutils')
-rw-r--r--Lib/distutils/tests/test_archive_util.py17
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
index 2881148..f01cec3 100644
--- a/Lib/distutils/tests/test_archive_util.py
+++ b/Lib/distutils/tests/test_archive_util.py
@@ -4,6 +4,7 @@ __revision__ = "$Id$"
import unittest
import os
+import sys
import tarfile
from os.path import splitdrive
import warnings
@@ -34,6 +35,18 @@ try:
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 @@ class ArchiveUtilTestCase(support.TempdirManager,
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 @@ class ArchiveUtilTestCase(support.TempdirManager,
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