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 difference with extra path separators #320

Closed
agroce opened this issue Oct 24, 2017 · 2 comments
Closed

open difference with extra path separators #320

agroce opened this issue Oct 24, 2017 · 2 comments
Labels

Comments

@agroce
Copy link

agroce commented Oct 24, 2017

import pyfakefs.fake_filesystem
import os

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

component0 = "alpha"
component1 = ""
path0 = "/Volumes/ramdisk/test"
path0 += "/" + component0
path0 += "/" + component1
fd0 = os0.open(path0, os.O_CREAT | os.O_WRONLY | os.O_TRUNC)

pyfakefs allows this, os complains with Errno 2 (no such file or directory, '/Volumes/ramdisk/test/alpha/')

@mrbean-bremen
Copy link
Member

Ah, these again... we usually strip the ending path separator during name resolving, so this probably needs some twiddling. Some other day...

@mrbean-bremen
Copy link
Member

Just for the record: OSError is raised on all systems in this scenario, but with different subtypes:
21 (Is a directory) under Linux
2 (File not found) under MacOS
22 (Invalid argument) 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

No branches or pull requests

2 participants