Skip to content

Commit 8241422

Browse files
committed
Fix test on macOS and WASI
* Skip TESTFN_UNENCODABLE if it's None. * Remove TESTFN_UNDECODABLE test.
1 parent 335c1bc commit 8241422

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Lib/test/test_capi/test_file.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@ def __fspath__(self):
2626
data = _testcapi.py_fopen(FSPath(filename), "rb")
2727
self.assertEqual(data, source[:256])
2828

29-
for filename in (
29+
filenames = [
3030
os_helper.TESTFN,
3131
os.fsencode(os_helper.TESTFN),
32-
os_helper.TESTFN_UNDECODABLE,
33-
os_helper.TESTFN_UNENCODABLE,
34-
):
32+
]
33+
# TESTFN_UNDECODABLE cannot be used to create a file on macOS/WASI.
34+
if os_helper.TESTFN_UNENCODABLE is not None:
35+
filenames.append(os_helper.TESTFN_UNENCODABLE)
36+
for filename in filenames:
3537
with self.subTest(filename=filename):
3638
try:
3739
with open(filename, "wb") as fp:

0 commit comments

Comments
 (0)