Skip to content

FakeDirectory could use OrderedDict for contents? #151

@FelixSchwarz

Description

@FelixSchwarz

For some tests I like to ensure that os.listdir returns the directory contents in a certain order (to check if my code actually sorts returned items). Currently FakeDirectory uses {} which also does not guarantee any ordering so my tests often work - but not always.

My workaround is to replace .byte_contents with an OrderedDict manually so items would be returned in the order of insertion. Is that something you could add to PyFakeFS directly?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions