Skip to content

FakeFileWrapper doesn't inherit from io.IOBase #484

@Aran-Fey

Description

@Aran-Fey

Regular file objects inherit from io.IOBase, but the fake variant doesn't. Here's a test case that fails if the fs fixture is used, but passes otherwise:

import pytest
import io, os

def test_file_mro(fs):
    try:
        with open('foo.txt', 'w') as file:
            assert isinstance(file, io.IOBase)
    finally:
        os.remove('foo.txt')

if __name__ == '__main__':
    pytest.main([__file__])

I'm working on a file-object related library, so I really need this to work correctly.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions