MCPcopy Create free account
hub / github.com/python/cpython / can_symlink

Function can_symlink

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

Source from the content-addressed store, hash-verified

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

Callers 3

setUpMethod · 0.90
test_recursive_globMethod · 0.90
skip_unless_symlinkFunction · 0.85

Calls 2

abspathMethod · 0.45
removeMethod · 0.45

Tested by 2

setUpMethod · 0.72
test_recursive_globMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…