-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
FakeFilesystem takes a path_separator arg, primarily useful for cross-platform
faking on Windows. However it doesn't override os.path.normcase, which on
Windows replaces forward-slashes with backslashes.
What steps will reproduce the problem?
import fake_filesystem
filesystem = fake_filesystem.FakeFilesystem(path_separator='/')
fake_os = fake_filesystem.FakeOsModule(filesystem)
os = fake_os # bash real os
print os.path.normcase('/tmp')
What is the expected output?
/tmp
What do you see instead?
\tmp
What version of the product are you using? On what operating system?
2.4, on Windows
This causes problems with e.g. the tempfile module, because it uses normcase
which produces invalid filenames in this situation.
I think the simplest solution is to just override os.path.normcase with a null
implementation that returns its arg on Windows, if the filesystem's
path_separator is '/'.
Original issue reported on code.google.com by [email protected]
on 2 May 2014 at 3:41