There was an error while loading. Please reload this page.
1 parent 47a23fc commit 2efe18bCopy full SHA for 2efe18b
2 files changed
Lib/test/test_importlib/fixtures.py
@@ -210,6 +210,17 @@ def build_files(file_defs, prefix=pathlib.Path()):
210
f.write(DALS(contents))
211
212
213
+class FileBuilder:
214
+ def unicode_filename(self):
215
+ try:
216
+ import test.support
217
+ except ImportError:
218
+ # outside CPython, hard-code a unicode snowman
219
+ return '☃'
220
+ return test.support.FS_NONASCII or \
221
+ self.skip("File system does not support non-ascii.")
222
+
223
224
def DALS(str):
225
"Dedent and left-strip"
226
return textwrap.dedent(str).lstrip()
Lib/test/test_importlib/test_main.py
@@ -254,11 +254,16 @@ def test_attr(self):
254
assert self.ep.attr is None
255
256
257
-class FileSystem(fixtures.OnSysPath, fixtures.SiteDir, unittest.TestCase):
+class FileSystem(
258
+ fixtures.OnSysPath, fixtures.SiteDir, fixtures.FileBuilder,
259
+ unittest.TestCase):
260
def test_unicode_dir_on_sys_path(self):
261
"""
262
Ensure a Unicode subdirectory of a directory on sys.path
263
does not crash.
264
- fixtures.build_files({'☃': {}}, prefix=self.site_dir)
265
+ fixtures.build_files(
266
+ {self.unicode_filename(): {}},
267
+ prefix=self.site_dir,
268
+ )
269
list(distributions())
0 commit comments