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

open that should fail succeeds #397

Closed
agroce opened this issue May 16, 2018 · 1 comment · Fixed by #405
Closed

open that should fail succeeds #397

agroce opened this issue May 16, 2018 · 1 comment · Fixed by #405
Labels

Comments

@agroce
Copy link

agroce commented May 16, 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 False:
    os0 = os
    shutil.rmtree(ROOT_PATH)
    os.mkdir(ROOT_PATH)
    opener0 = open

component0 = "alpha" 
path0 = ROOT_PATH 
path1 = ROOT_PATH 
path0 += os.path.sep + component0 
component0 = "" 
path0 += os.path.sep + component0 
component0 = "beta" 
path1 += os.path.sep + component0 
os0.symlink(path0,path1) 
file0 = opener0(path1,'a') 

OS returns IOError: [Errno 2] No such file or directory: '/Volumes/ramdisk/test/beta'

The 'a' in the open could also be a 'w' and it still fails

@mrbean-bremen
Copy link
Member

Does not raise in pyfakefs, raises IOError 21 under Linux, IOError 2 under MacOS and OSError 22 under Windows.

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