]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-12915: Skip test_pkgutil.test_name_resolution() non-encodable filenames (GH-18720)
authorMichael Felt <aixtools@users.noreply.github.com>
Tue, 3 Mar 2020 10:11:11 +0000 (11:11 +0100)
committerGitHub <noreply@github.com>
Tue, 3 Mar 2020 10:11:11 +0000 (11:11 +0100)
When filesystem encoding cannot encode the Unicode string used for a filename
continue testing with the next example.

Lib/test/test_pkgutil.py

index 53456c2f7659e2e05c2bd393e37cb8ec3b3ccfcc..b162f9949ff6971ccefffeb64200ba08abf6c30d 100644 (file)
@@ -246,7 +246,11 @@ class PkgutilTests(unittest.TestCase):
 
         for uw in unicode_words:
             d = os.path.join(self.dirname, uw)
-            os.makedirs(d, exist_ok=True)
+            try:
+                os.makedirs(d, exist_ok=True)
+            except  UnicodeEncodeError:
+                # When filesystem encoding cannot encode uw: skip this test
+                continue
             # make an empty __init__.py file
             f = os.path.join(d, '__init__.py')
             with open(f, 'w') as f: