Description
How To Reproduce
from pyfakefs.fake_filesystem import FakeFilesystem
from pyfakefs.fake_open import FakeFileOpen
from pyfakefs.fake_pathlib import FakePathlibModule
fake_fs = FakeFilesystem()
fake_open = FakeFileOpen(fake_fs)
fake_pathlib = FakePathlibModule(fake_fs)
f = open("test.txt")
assert f.mode # This works fine
fake_pathlib.Path("test.txt").write_text(f.read())
f_ = fake_open("test.txt")
assert f_.mode # This fails
Expected behavior:
Fake file objects should properly implement the mode property as required by the typing.io.IO abstract class:
class IO(Generic[AnyStr]):
@property
@abstractmethod
def mode(self) -> str:
pass
Your environment
python3.9
pyfakefs==5.8.0
Metadata
Metadata
Assignees
Labels
No labels