pyfakefs implements a fake file system that mocks the Python file system modules. If using pyfakefs, the tests operate on a fake file system in memory without touching the real disk. pyfakefs directly supports unittest and pytest, and can be used with other testing frameworks.
Reference: