MCPcopy Index your code
hub / github.com/RustPython/RustPython / can_symlink

Function can_symlink

Lib/test/support/os_helper.py:174–191  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

172
173
174def can_symlink():
175 global _can_symlink
176 if _can_symlink is not None:
177 return _can_symlink
178 # WASI / wasmtime prevents symlinks with absolute paths, see man
179 # openat2(2) RESOLVE_BENEATH. Almost all symlink tests use absolute
180 # paths. Skip symlink tests on WASI for now.
181 src = os.path.abspath(TESTFN)
182 symlink_path = src + "can_symlink"
183 try:
184 os.symlink(src, symlink_path)
185 can = True
186 except (OSError, NotImplementedError, AttributeError):
187 can = False
188 else:
189 os.remove(symlink_path)
190 _can_symlink = can
191 return can
192
193
194def skip_unless_symlink(test):

Callers 3

setUpMethod · 0.90
test_recursive_globMethod · 0.90
skip_unless_symlinkFunction · 0.85

Calls 1

removeMethod · 0.45

Tested by 2

setUpMethod · 0.72
test_recursive_globMethod · 0.72