Skip to content

should override os.path.normcase on Windows #28

@GoogleCodeExporter

Description

@GoogleCodeExporter
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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions