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.
Regular file objects inherit from
io.IOBase, but the fake variant doesn't. Here's a test case that fails if thefsfixture is used, but passes otherwise:I'm working on a file-object related library, so I really need this to work correctly.