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
I am having issues with the fake shutil module. It seems to fail if the directory has a trailing slash. Am I using this incorrectly?
Here is the exception from when I run the sample program below on Python 3.5, pyfakefs 3.1:
Traceback (most recent call last):
File "/Users/dev/.virtualenvs/xyz/lib/python3.5/site-packages/pyfakefs/fake_filesystem.py", line 1533, in RemoveObject
target_directory.RemoveEntry(basename)
File "/Users/dev/.virtualenvs/xyz/lib/python3.5/site-packages/pyfakefs/fake_filesystem.py", line 474, in RemoveEntry
entry = self.contents[pathname_name]
KeyError: ''
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "test_rmtree.py", line 28, in <module>
test_fakefs()
File "test_rmtree.py", line 15, in test_fakefs
FakeShutilModule(fs2).rmtree('x/')
File "/Users/dev/.virtualenvs/xyz/lib/python3.5/site-packages/pyfakefs/fake_filesystem_shutil.py", line 112, in rmtree
self.filesystem.RemoveObject(path)
File "/Users/dev/.virtualenvs/xyz/lib/python3.5/site-packages/pyfakefs/fake_filesystem.py", line 1537, in RemoveObject
file_path)
import os
import shutil
from pyfakefs.fake_filesystem_shutil import FakeShutilModule
import pyfakefs.fake_filesystem as fake_fs
def test_fakefs():
fs = fake_fs.FakeFilesystem()
fake_fs.FakeOsModule(fs).mkdir('x')
FakeShutilModule(fs).rmtree('x')
fs2 = fake_fs.FakeFilesystem()
fake_fs.FakeOsModule(fs2).mkdir('x')
FakeShutilModule(fs2).rmtree('x/')
def test_real():
os.mkdir('x')
shutil.rmtree('x')
os.mkdir('x')
shutil.rmtree('x/')
if __name__ == '__main__':
test_real()
test_fakefs()
The text was updated successfully, but these errors were encountered:
Hi,
I am having issues with the fake shutil module. It seems to fail if the directory has a trailing slash. Am I using this incorrectly?
Here is the exception from when I run the sample program below on Python 3.5, pyfakefs 3.1:
The text was updated successfully, but these errors were encountered: