mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
test.support: can_symlink() removes the temporary symbolic link
This commit is contained in:
parent
5b52f95797
commit
62ec61fb6a
1 changed files with 4 additions and 1 deletions
|
@ -1487,11 +1487,14 @@ def can_symlink():
|
||||||
global _can_symlink
|
global _can_symlink
|
||||||
if _can_symlink is not None:
|
if _can_symlink is not None:
|
||||||
return _can_symlink
|
return _can_symlink
|
||||||
|
symlink_path = TESTFN + "can_symlink"
|
||||||
try:
|
try:
|
||||||
os.symlink(TESTFN, TESTFN + "can_symlink")
|
os.symlink(TESTFN, symlink_path)
|
||||||
can = True
|
can = True
|
||||||
except (OSError, NotImplementedError):
|
except (OSError, NotImplementedError):
|
||||||
can = False
|
can = False
|
||||||
|
else:
|
||||||
|
os.remove(symlink_path)
|
||||||
_can_symlink = can
|
_can_symlink = can
|
||||||
return can
|
return can
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue