pyfilesystem2
pyfilesystem2 copied to clipboard
MountFS fixes
Type of changes
- Bug fix
- Tests
Checklist
- [x] I've run the latest black with default args on new code.
- [ ] I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
- [x] I've added tests for new code.
- [x] I accept that @PyFilesystem/maintainers may be pedantic in the code review.
Description
Addresses issues outlined #486
- Don't allow MountFS to have an empty mount-path
- Don't allow files/dirs to be created inside MountFS's internal MemoryFS
- Change MountFS's .mounts attribute to a dict instead of a list of tuples
- Add a MountFS.unmount method
- Add associated unit-tests
It's a long time since I've done any PyFilesystem development, so this should should be considered "WIP code", comments welcome... (e.g. I'm not sure if the unmount method is actually useful?)
This should be reviewed with care as the "bugfixes" this includes (the first two bullet-points above) subtly change the API of MountFS.