mardi 7 mai 2019

Is it possible to mock the platform for reading and writing files in binary and text mode?

I would to test if a system reads and writes files correctly (text mode / binary mode) on multiple platforms, at least on linux and windows. (Using pytest).

See https://docs.python.org/2/tutorial/inputoutput.html#reading-and-writing-files

It is possible to mock a filesystem with pyfakefs, for example. But I have not been able to find a mock for simulating the windows behaviour with files opened in text mode, when running the tests on linux.

Is it possible to force the translation of eol (\r\n to \n) in text mode, running on linux?

Aucun commentaire:

Enregistrer un commentaire