diff options
author | Jason R. Coombs <jaraco@jaraco.com> | 2011-12-28 15:45:08 (GMT) |
---|---|---|
committer | Jason R. Coombs <jaraco@jaraco.com> | 2011-12-28 15:45:08 (GMT) |
commit | bbb0803924510a128ec095e47c97fda8406bcb74 (patch) | |
tree | 4627ee5caeedfbc77d2cb9956cf81d58ad7ca825 /Lib/distutils/tests | |
parent | 70069fcd4b327eb4a6d91a27db7a423e71711b97 (diff) | |
download | cpython-bbb0803924510a128ec095e47c97fda8406bcb74.zip cpython-bbb0803924510a128ec095e47c97fda8406bcb74.tar.gz cpython-bbb0803924510a128ec095e47c97fda8406bcb74.tar.bz2 |
Limit test scope to those platforms that can save the target filenames. Reference #11638.
Diffstat (limited to 'Lib/distutils/tests')
-rw-r--r-- | 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 index a6aeaf0..1afdd46 100644 --- a/Lib/distutils/tests/test_archive_util.py +++ b/Lib/distutils/tests/test_archive_util.py @@ -2,6 +2,7 @@ """Tests for distutils.archive_util.""" import unittest import os +import sys import tarfile from os.path import splitdrive import warnings @@ -26,6 +27,18 @@ try: except ImportError: ZLIB_SUPPORT = False +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, @@ -36,6 +49,8 @@ class ArchiveUtilTestCase(support.TempdirManager, self._make_tarball('archive') @unittest.skipUnless(ZLIB_SUPPORT, 'Need zlib support to run') + @unittest.skipUnless(can_fs_encode('årchiv'), + 'File system cannot handle this filename') def test_make_tarball_latin1(self): """ Mirror test_make_tarball, except filename contains latin characters. @@ -43,6 +58,8 @@ class ArchiveUtilTestCase(support.TempdirManager, self._make_tarball('årchiv') # note this isn't a real word @unittest.skipUnless(ZLIB_SUPPORT, 'Need zlib support to run') + @unittest.skipUnless(can_fs_encode('のアーカイブ'), + 'File system cannot handle this filename') def test_make_tarball_extended(self): """ Mirror test_make_tarball, except filename contains extended |