Skip to content

Commit 2cb809a

Browse files
committed
Add workaround for AIX issue reported in bpo-39791.
1 parent 366c2d3 commit 2cb809a

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

importlib_metadata/tests/fixtures.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,17 @@ def build_files(file_defs, prefix=pathlib.Path()):
215215
f.write(DALS(contents))
216216

217217

218+
class FileBuilder:
219+
def unicode_filename(self):
220+
try:
221+
import test.support
222+
except ImportError:
223+
# outside CPython, hard-code a unicode snowman
224+
return '☃'
225+
return test.support.FS_NONASCII or \
226+
self.skip("File system does not support non-ascii.")
227+
228+
218229
def DALS(str):
219230
"Dedent and left-strip"
220231
return textwrap.dedent(str).lstrip()

importlib_metadata/tests/test_main.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -258,11 +258,16 @@ def test_attr(self):
258258
assert self.ep.attr is None
259259

260260

261-
class FileSystem(fixtures.OnSysPath, fixtures.SiteDir, unittest.TestCase):
261+
class FileSystem(
262+
fixtures.OnSysPath, fixtures.SiteDir, fixtures.FileBuilder,
263+
unittest.TestCase):
262264
def test_unicode_dir_on_sys_path(self):
263265
"""
264266
Ensure a Unicode subdirectory of a directory on sys.path
265267
does not crash.
266268
"""
267-
fixtures.build_files({'☃': {}}, prefix=self.site_dir)
269+
fixtures.build_files(
270+
{self.unicode_filename(): {}},
271+
prefix=self.site_dir,
272+
)
268273
list(distributions())

0 commit comments

Comments
 (0)