diff --git a/Lib/distutils/tests/test_bdist_dumb.py b/Lib/distutils/tests/test_bdist_dumb.py --- a/Lib/distutils/tests/test_bdist_dumb.py +++ b/Lib/distutils/tests/test_bdist_dumb.py @@ -24,6 +24,12 @@ except ImportError: ZLIB_SUPPORT = False +try: + os.path.normpath(sys.prefix).encode("utf8") + PREFIX_NOT_UTF8 = False +except UnicodeEncodeError: + PREFIX_NOT_UTF8 = True + class BuildDumbTestCase(support.TempdirManager, support.LoggingSilencer, @@ -42,6 +48,7 @@ super(BuildDumbTestCase, self).tearDown() @unittest.skipUnless(ZLIB_SUPPORT, 'Need zlib support to run') + @unittest.skipIf(PREFIX_NOT_UTF8, 'prefix is not encodable to utf8') def test_simple_built(self): # let's create a simple package diff --git a/Lib/distutils/tests/test_install.py b/Lib/distutils/tests/test_install.py --- a/Lib/distutils/tests/test_install.py +++ b/Lib/distutils/tests/test_install.py @@ -16,6 +16,13 @@ from distutils.tests import support +try: + os.path.normpath(sys.prefix).encode("utf8") + PREFIX_NOT_UTF8 = False +except UnicodeEncodeError: + PREFIX_NOT_UTF8 = True + + class InstallTestCase(support.TempdirManager, support.EnvironGuard, support.LoggingSilencer, @@ -166,6 +173,7 @@ cmd.user = 'user' self.assertRaises(DistutilsOptionError, cmd.finalize_options) + @unittest.skipIf(PREFIX_NOT_UTF8, 'prefix is not encodable to utf8') def test_record(self): install_dir = self.mkdtemp()