Skip to content

Commit 571bb95

Browse files
committed
Ensure unlink gets fspath treatment
1 parent 379f1a5 commit 571bb95

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

importlib_resources/tests/_compat.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,18 @@ class import_helper:
66
from test.support import modules_setup, modules_cleanup
77

88

9+
try:
10+
from os import fspath
11+
except ImportError:
12+
# Python 3.5
13+
fspath = str
14+
15+
916
try:
1017
# Python 3.10
1118
from test.support.os_helper import unlink
1219
except ImportError:
13-
from test.support import unlink # noqa
20+
from test.support import unlink as _unlink
21+
22+
def unlink(target):
23+
return _unlink(fspath(target))

0 commit comments

Comments
 (0)