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

Bad isdir result #387

Closed
agroce opened this issue May 10, 2018 · 4 comments · Fixed by #388
Closed

Bad isdir result #387

agroce opened this issue May 10, 2018 · 4 comments · Fixed by #388
Labels

Comments

@agroce
Copy link

agroce commented May 10, 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)

path0 = ROOT_PATH
component0 = "" 
path0 += os.path.sep + component0 
result = os0.path.isdir(path0) 

print result
@agroce
Copy link
Author

agroce commented May 11, 2018

(Note that fixing this one will help testing a good bit; incorrect isdir turns out to cause some other issues, when it tries to avoid doing certain operations on directories; I have a big pile of issues from a new test run, but think several are this problem)

@mrbean-bremen
Copy link
Member

Yes, this one is MacOS-specific (in the sense that the bug is a regression that only appears under MacOS due to another fix that handled MacOS-specific behavior). I think I have a fix, but I have to wait for the Travis MacOS build to be sure - they currently have problems with MacOS builds (again).
Generally, the rate of regressions here is way too high - this is due to the fact that the behavior for these cases (trailing separator stuff, but also buffering stuff with open/seek/tell) is quite erratic (at least it seems so to me), and usually differs between the different OSes, so what I'm doing here is basically TDD without really understanding the problems.

@agroce
Copy link
Author

agroce commented May 11, 2018

Yeah, the logic here is sort of random nonsense for each OS, since it's not POSIX-specified. We could drop trailing separators for now, and look for more interesting issues, though some of these can cause some weird behaviors if you assume one OS then migrate to pyfakefs, I guess.

@agroce
Copy link
Author

agroce commented May 11, 2018

(I had the same Travis mac issue, so just do TSTL mac tests on the laptop I develop on anyway)

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