You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pyfakefs doesn't seem to honor permissions when deleting files. I marked a
directory and the files contained within as read-only using the fake_os
module's chmod function, but os.remove and shutil.rmtree were able to remove
the files without issue.
What steps will reproduce the problem?
# Create filesystem with '/dir1/file1'
path = os.path.join('dir1', 'file1')
mode = self.fake_os.stat(path)[stat.ST_MODE]
self.fake_os.chmod('dir1', 0444)
self.fake_os.chmod(path, 0444)
self.fake_os.remove(path)
What is the expected output? What do you see instead?
I would expect an "OSError: [Errno 13] Permission denied" or equivalent,
instead the file is removed.
What version of the product are you using? On what operating system?
pyfakefs 2.4, tested on Windows 7 and Red Hat 6
Please provide any additional information below.
It would be really helpful to acknowledge permissions, since many tests I write
are around "how does my program behave if it doesn't have access to the
necessary files?"
Original issue reported on code.google.com by londinop on 28 Feb 2014 at 5:02
The text was updated successfully, but these errors were encountered:
- raise on file deletion if missing write permission
- raise on deleting an open file under Windows
- make sure check is done recursively if deleting directories
- fixespytest-dev#27
Original issue reported on code.google.com by
londinop
on 28 Feb 2014 at 5:02The text was updated successfully, but these errors were encountered: