Fix symlink handling in OSFS by althonos · Pull Request #431 · PyFilesystem/pyfilesystem2
Type of changes
- Bug fix
Checklist
- I've run the latest black with default args on new code.
- I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
- I've added tests for new code.
- I accept that @willmcgugan may be pedantic in the code review.
Description
Closes #425
Changes the expected behaviour of FS.islink in tests so that is never raises ResourceNotFound, to be consistent with FS.isfile and FS.isdir.
Changes the base FS.islink implementation to one that uses FS.gettype to check if the resource type is symlink.
Closes #411
Fixes the behaviour of the following OSFS methods so that they work as expected:
-
OSFS.islink(path): returnsTrueon existing path to a symlink,Falseotherwise -
OSFS.gettype(path): returnsResourceType.symlinkis the path maps to a symlink (not the case before) -
OSFS.getinfo(path): works even ifpathis a dangling symlink (TODO) -
OSFS.scandir(dir): works even ifdircontains a dangling symlink (TODO)