-
Notifications
You must be signed in to change notification settings - Fork 91
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
Empty cwd on filesystem leads to error on .absolute() paths (Windows) #673
Comments
Thanks for the report! There is indeed a problem with the root path under Windows, which is not a drive but just Anyway, I think I have to revisit this, now that there is a real problem, but this may take some time. |
@mrbean-bremen thanks for your quick response and makes sense! So would adjusting the If I can be of any further help please let me know. |
Maybe this can be solved with a quick fix for |
I think I have to fix this properly, which will take some time. I started to adapt the code accordingly, and while there are several changes needed in tha actual code, more changes are needed in the tests, as a lot of them fail due to assumptions that are no longer true. I'm not sure when I will get the time to finish this (short on free time at the moment), but I think it makes sense to do this anyway. |
- as Windows has no root dir as such, we use the current drive as root dir to better emulate the fs - as in the real fs, if a path starts with a path separator, it points to the current drive (e.g. the root of cwd) - fixes pytest-dev#673
- as Windows has no root dir as such, we use the current drive as root dir to better emulate the fs - as in the real fs, if a path starts with a path separator, it points to the current drive (e.g. the root of cwd) - fixes pytest-dev#673
- as Windows has no root dir as such, we use the current drive as root dir to better emulate the fs - as in the real fs, if a path starts with a path separator, it points to the current drive (e.g. the root of cwd) - fixes pytest-dev#673
- as Windows has no root dir as such, we use the current drive as root dir to better emulate the fs - as in the real fs, if a path starts with a path separator, it points to the current drive (e.g. the root of cwd) - fixes pytest-dev#673
- as Windows has no root dir as such, we use the current drive as root dir to better emulate the fs - as in the real fs, if a path starts with a path separator, it points to the current drive (e.g. the root of cwd) - fixes #673
…r as such, we use the current drive as root dir to better emulate the fs - as in the real fs, if a path starts with a path separator, it points to the current drive (e.g. the root of cwd) - fixes #673
Fixed in master, please check it out. I hope that I didn't introduce too many regressions, but I can't rule it out, as the handling of the root path under Windows has changed sufficiently. |
Describe the bug
When using this module on a Windows environment, whenever a patched out
os.getcwd
is used ( i.e. due to calling asetUpPyfakefs
/ usingFakeOsModule
), it's no longer possible to retrieve a real absolute path on any pathlib.Path object on Windows filesystem, since a drive letter will always be omitted.See reference for
.absolute()
in pathlib code at https://github.com/python/cpython/blob/b28265d7e6a41a4a0e227b37f4fbbc4d03a0a707/Lib/pathlib.py#L1193-L1207Maybe we can change the implementation on
FakeOsModule.getcwd()
/FakeOsModule.getcwdb()
?How To Reproduce
Please provide a unit test or a minimal code snippet that reproduces the problem.
Your environment
The text was updated successfully, but these errors were encountered: