pyfilesystem2 icon indicating copy to clipboard operation
pyfilesystem2 copied to clipboard

MountFS fixes

Open lurch opened this issue 4 years ago • 1 comments

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.

lurch avatar Jun 20 '21 20:06 lurch

Coverage Status

Coverage decreased (-0.02%) to 95.246% when pulling a99ccd2790cb75f4c8eef9c8b251eaad40e42006 on mountfs_fixes into 2d0ffc34a2127db3fdf0f8fef6f4644bf7500a1e on master.

coveralls avatar Jun 20 '21 20:06 coveralls