Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rename allowed by OS, disallowed by pyfakefs #391

Closed
agroce opened this issue May 14, 2018 · 1 comment · Fixed by #394
Closed

rename allowed by OS, disallowed by pyfakefs #391

agroce opened this issue May 14, 2018 · 1 comment · Fixed by #394
Labels

Comments

@agroce
Copy link

agroce commented May 14, 2018

import shutil
import pyfakefs.fake_filesystem
import os

ROOT_PATH = "/Volumes/ramdisk/test"

fs = pyfakefs.fake_filesystem.FakeFilesystem()
fs.CreateDirectory('/Volumes')
fs.CreateDirectory('/Volumes/ramdisk')
fs.CreateDirectory('/Volumes/ramdisk/test')
os0 = pyfakefs.fake_filesystem.FakeOsModule(fs)
opener0 = pyfakefs.fake_filesystem.FakeFileOpen(fs)

if True:
    os0 = os
    shutil.rmtree(ROOT_PATH)
    os.mkdir(ROOT_PATH)

path0 = ROOT_PATH 
path1 = ROOT_PATH 
component0 = "alpha" 
component1 = "" 
path1 += os.path.sep + component0 
os0.symlink(path0,path1) 
path1 += os.path.sep + component1 
os0.rename(path1,path0) 

pyfakefs raises: OSError: [Errno 21] Is a directory in the fake filesystem: '/Volumes/ramdisk/test'

@mrbean-bremen
Copy link
Member

Under Linux shall raise OSError: [Errno 20], but raises OSError: [Errno 21].
Under MacOS shall not raise, but raises OSError: [Errno 21].
Under Windows correctly raises OSError: [Errno 17].

mrbean-bremen added a commit to mrbean-bremen/pyfakefs that referenced this issue May 15, 2018
- fixed renaming symlink ending with trailing separator under linux and macos
- fixes pytest-dev#391
mrbean-bremen added a commit that referenced this issue May 15, 2018
- fixed renaming symlink ending with trailing separator under linux and macos
- fixes #391
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants