NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #2216 most downloaded on PyPI
Implements a fake file system that mocks the Python file system modules.
Last release 5 months ago
12 Apr 2026
Ships fairly regularly
a new release about every 4 weeks
Nearly every release is documented
notes for 56 of the last 60 stable releases
1 version withdrawn
withdrawn after publishing
13 years old
93 releases · first in 2013
changes the MRO for file wrappers
Changes the MRO for file wrappers.
io.TextIOBase or io.BufferedIOBase,
so that isinstance-checks for these classes succeed
(see #1307
and #484)os.urandom and related functions work correctly with PyPy
(see #1300)seek method did not return the location in the file
(see #1304)hash(), Path.match and Path.full_match
(see #1308)pytest for testing in CIOne column per quarter.
Follow-up bugfix release for release 6.1.5.
Follow-up bugfix release for release 6.1.5.
Follow-up bugfix release for 6.1.5.
os.path.realpath did not correctly handle some absolute paths under Windows
(previous fix was incomplete, see #1296)Fixes a Windows-specific issue with os.path.realpath .
Fixes a Windows-specific issue with os.path.realpath.
Fixes an incompatibility with the VCCode unittest runner.
Fixes an incompatibility with the VCCode unittest runner.
Fixes incompatibility with VCCode unittest runner.
handle expanduser() and home() correctly in cross OS usage (see #1289)
Fixes a regression caused by the introduced weak references.
Fixes a regression caused by the introduced weak references.
Fixes a regression caused by the introduced weakrefs.
fixes a packaging issue in latest version
Fixes a packaging issue in latest version.
changes back-link references to weak references
Changes back-link references to weak references.
pyproject.toml for dependencies, moved tox configuration into pyproject.tomlremoves some deprecated functionality
Removes some deprecated functionality, removes support for Python < 3.10.
pyfakefs 5.10
supporting older versions may be made on demandscandir and pathlib2FakeFilesystem.shuffle_listdir_results to True to reflect
the real filesystem behaviorPath type hints using the pipe symbol in wrapped functions
inside an fs dependent fixture (see #1242)coverage in Python 3.14 using the fake filesystem
(see #1245)fixes a problem with pathlib.glob in Python 3.14
pathlib.glob in Python 3.14Fixes a problem with pathlib.glob in Python 3.14.
pathlib.glob() for Python 3.14 (see #1239)Fixes a regression introduced in version 5.9.0.
Fixes a regression introduced in version 5.9.0.
shutil.copytree if copying using an shutil function as
copy_function argument (see #1235)Adds official support for Python 3.14. Last minor version before the 6.0 release.
Adds official support for Python 3.14. Last minor version before the 6.0 release.
errno codes set in OSError have changed for some specific error conditions
in Windows 11/Windows Server 2025; pyfakefs now matches this behavior
instead of the previous behavior under Windows 10os.readinto in Python 3.14pathlib.copy and pathlib.copy_into in Python 3.14tempfile in Python 3.13 (
see #1214)a warning is now issued if trying to create a nested fake filesystem with custom arguments (custom arguments are ignored in this case, as the existing
Fixes a utility method.
fake_filesystem.add_package_metadata that had never worked correctly
(see #1205)fixed an interaction problem of fs with other pytest fixtures ( see #1200)
Fixes regression in packaging in version 5.9.0.
Fixes regression in packaging in version 5.9.0.
strict argument in Python 3.9.23Adds support for an API change in latest Python patch releases.
Adds support for an API change in latest Python patch releases.
OSError raised in the fake filesystem has no longer the postfix
"in the fake filesystem" (see #1159)FakeShutilModule to prepare it for usage without the patcher
(see #1171)add_package_metadata to add the metadata of a given
package to the fake filesystem (see #1155)mode property to fake file wrapper (see #1162)FakePathlibModule for Python >= 3.11
(see #1169)strict argument in os.path.realpath
(introduced in latest patch version of Python >= 3.10,
see #1180)setup.py and setup.cfg in favor of pyproject.tomlAdds preliminary support for Python 3.14.
Adds preliminary support for Python 3.14.
FakeFilesystem.get_object() to ignore permissions as it has been
before version 5.4.0 (see #1122)os.access for symlinks under Windowsfixed a problem with module and session scoped fixtures in Python 3.13 (see #1101)
Fixes a regression in version 5.7.3.
Fixes a regression in version 5.7.3.
tempfile was not patched after pause/resume
(POSIX only, see #1098)Fixes some problems with patching.
Fixes some problems with patching.
AUTO patch mode
using importlib.import_module (see #1079)tempfile in Posix systemsFixes a regression in version 5.7.0 that broke patching fcntl.
Fixes a regression in version 5.7.0 that broke patching fcntl.
fcntl calls to fail (
see #1074)Adds official Python 3.13 support, improves OS emulation behavior.
Adds official Python 3.13 support, improves OS emulation behavior.
additional_skip_names parameter now works with more modules (
see #1023)os.fchmod, allow file descriptor argument for os.chmod only for POSIX
for Python < 3.13glob in Python 3.13scandir results is now possible (
see #1051)pathlib.PosixPath and pathlib.WindowsPath now behave more like in the real filesystem
(see #1053)PurePosixPath reported Windows reserved names as reserved in Python >= 3.12
(see #1067)PurePosixPath.joinpath() incorrectly handled paths with drives under Windows in Python >= 3.12
(see #1070)Adds preliminary Python 3.13 support.
Adds preliminary Python 3.13 support.
apply_umask argument to FakeFilesystem.create_dir to allow ignoring the umask (
see #1038)pathlib functions so that it works nice with skippedmodules (
see #1012)Deprecates the usage of pathlib2 and scandir.
Deprecates the usage of pathlib2 and scandir.
pathlib2 and scandir modules in pyfakefs is now deprecated.
They will now cause deprecation warnings if still used. Support for patching
these modules will be removed in pyfakefs 6.0.PureWindowsPath and PurePosixPath now use filesystem-independent path separators,
and their path-parsing behaviors are now consistent regardless of runtime platform
and/or faked filesystem customization (see #1006).fixed a regression from version 5.4.0 that incorrectly handled files opened twice via file descriptor (see #997)
Fixes a regression.
the handling of file permissions under Posix should now mostly match the behavior of the real filesystem, which may change the behavior of some tests
Improves permission handling.
module_cleanup_mode, that was introduced as a temporary workaround
in the previous version - related problems shall be handled using a cleanup handlerO_NOFOLLOW and O_DIRECTORY flags in os.open
(see #972
and #974)os.dup, os.dup2 and os.lseek (
see #970)EncodingWarning for Python >= 3.11 (see #957)dirfd in os.symlink (see #968)follow_symlink argument to os.link (see #973)os.getxattr (see #971)shutil.rmtree if emulating Windows under POSIX
(see #979)umask - it is now applied by defaultos.makedirs (see #987)undefined by own minimal implementation to avoid importing it
(see #981)Fixed a regression due to the changed behavior of the dynamic patcher cleanup ( see #939). The change is now by default only made if the django module
Fixes a regression.
django module is loaded, and the behavior can
be changed using the new argument module_cleanup_mode.tox.ini and a few more files into the source distribution (
see #937)fixed handling of unhashable modules which cannot be cached ( see #923)
Nothing published for this version
fixed a problem with patching _io under Python 3.12 (see #910)
Bugfix release.
_io under Python 3.12 (see #910)os.walk with a path-like top directory
(see #915)changed behavior of add_real_directory to be able to map a real directory to an existing directory in the fake filesystem (see #901)
Mostly a bugfix release.
add_real_directory to be able to map a real directory
to an existing directory in the fake filesystem (see #901)Adds official support for Python 3.12.
Adds official support for Python 3.12.
Fixes a rare problem on pytest shutdown.
Fixes a rare problem on pytest shutdown.
Patcher.clear_fs_cache
for clearing the patched module cache.Adds compatibility with PyPy 3.10 and Python 3.12.
Adds compatibility with PyPy 3.10 and Python 3.12.
pathlib modules from patching to avoid mixup of patched/unpatched
code (see #814).shutil in Python 3.12 beta2 (see #814).sqlite3 module with
pyfakefs (see #850)Made the user and group IDs accessible via dedicated get_uid and get_gid functions (for symmetry to set_uid / set_gid)
Fixes a regression in 5.2.0
get_uid and get_gid
functions (for symmetry to set_uid / set_gid)fake_filesystem that had been moved to helpers are
made accessible from there again (see #809).os.getuid and os.getgid (Posix only)/tmp path exists under linux (TMPDIR may point elsewhere)
(see #810)Support for latest Python 3.12 version.
Support for latest Python 3.12 version.
os functions like
os.supports_follow_symlinks are now properly faked to contain the fake functions
if the real functions are faked (see #799)Supports current Python 3.12 version (alpha 6). We plan to make patch releases in case of breaking changes in alpha or beta versions.
Supports current Python 3.12 version (alpha 6). We plan to make patch releases in case of breaking changes in alpha or beta versions.
fake_filesystem have now moved to
their own modules: fake_os.FakeOsModule, fake_path.FakePathModule,
fake_io.FakeIoModule and fake_open.FakeFileOpen. Additionally, all fake file
classes have been moved to fake_file. While most of the changes shall be upwards
compatible, we cannot exclude that we missed some problems./tmp to the actual temporary directory is
now created in the fake filesystem.chown() with
the force_unix_mode flag (see #720)os.path.splitroot (new in Python 3.12)New version before Debian freeze
New version before Debian freeze
setUpClassPyfakefs for unittest and class-scoped
fixture fs_class for pytest (see #752)False.the old-style API deprecated since version 3.4 has now been removed
New version after the transfer to pytest-dev.
copyRealFile deprecated since version 3.2 has been removed -
use add_real_file insteadpytest-dev organizationmaster branch to mainst_blocks in stat result
(see #722)Changed handling of nested fixtures and bug fixes.
Changed handling of nested fixtures and bug fixes.
fs fixtures cannot be nested; any nested fs fixture (for example
inside an fs_session or fs_module fixture) will just reference the outer
fixture (the behavior had been unexpected before)pathlib as it may cause problems
(see #697)shutil.disk_usage
(see #699)setup.py
(see #707)fcntl.ioctl and fcntl.fcntl calls if arg
is of type byte; the call itself does nothing as beforeos.renames (see #714)Another patch release that fixes a regression in version 4.6.
Another patch release that fixes a regression in version 4.6.
automatically reset filesystem on changing is_windows_fs or is_macos
(see #692) - ensures better upwards compatibility in
most cases
:warning: Make sure you write to the filesystem after you change
is_windows_fs or is_macos, otherwise the changes will be lost.
os.path.exists returned True for any root drive path under WindowsPatch release that fixes an error in the previous patch.
Patch release that fixes an error in the previous patch.
opener introduced in previous patch release
(see #689)Fixes incompatibility with Python 3.11 beta 4.
Fixes incompatibility with Python 3.11 beta 4.
Note: Python 3.11 is only supported in the current beta 4 version, problems with later beta or rc versions are still possible. We will try to fix such problems in short order should they appear.
opener argument in open, which is used in tempfile
in Python 3.11 since beta 4 (see #686)pyfakefs installed as a package
(see #687)Adds support for Python 3.11, removes support for Python 3.6, changes root path behavior under Windows.
Adds support for Python 3.11, removes support for Python 3.6, changes root path behavior under Windows.
os.stat_float_times has been removed in Python 3.7 and is therefore no
longer supportedC:\ instead of \; a
path starting with \ points to the current drive as in the real file
system (see #673)pathlib.Path.owner() and pathlib.Path.group() now behave like the
real methods - they look up the real user/group name for the user/group id
that is associated with the fake file (see #678)fs fixtures
(fs_module and fs_session)Fixes a regression which broke tests with older pytest versions (< 3.9).
Fixes a regression which broke tests with older pytest versions (< 3.9).
_pytest.pathlib in pytest versions where it is actually present
(see #669)Bugfix release, needed for compatibility with pytest 7.0.
Bugfix release, needed for compatibility with pytest 7.0.
added missing mocked functions for fake pipe (see #650)
Reverts a change in the previous release that could cause a regression.
Reverts a change in the previous release that could cause a regression.
os.listdir, os.scandir and pathlib.Path.listdir now return the
directory list in a random order only if explicitly configured in the
file system (use fs.shuffle_listdir_results = True with fs being the
file system). In a future version, the default may be changed to better
reflect the real filesystem behavior (see #647)os.listdir, os.scandir and pathlib.Path.listdir now return the directory list in a random order (see #638)
added handling of path-like where missing
This is a bugfix release.
str/bytes pathspathlib.Path.owner() and pathlib.Path.group by returning
the current user/group name (see #629)use_known_patches=False (could cause an exception)Adds some support for Python 3.10 and basic type checking.
Adds some support for Python 3.10 and basic type checking.
Note: This version has been yanked from PyPI as it erroneously allowed installation under Python 3.5.
pathlib.Path.hardlink_tonewline argument in pathlib.Path.write_textfollow_symlinks argument in pathlib.Path.stat and
pathlib.Path.chmodos.path.realpathpathlib2 is still supported, but considered to have the same
functionality as pathlib and is no longer tested separately;
the previous behavior broke newer pathlib features if pathlib2
was installed (see #592)os.path.exists
(see #595)fake_pathlib to support changes coming in Python 3.10
(seeos.path.split and in directory path
evaluation (see #606)Adds better support for Python 3.8 / 3.9.
Adds better support for Python 3.8 / 3.9.
pathlib.Path.link_to (new in Python 3.8)
(see #580)pathlib.Path.readlink (new in Python 3.9)
(see #584)FakeFilesystem.create_link convenience method which creates
intermittent directories (see #580)effective_ids to os.access
(see #585)os.file for unreadable files
(see #588)Reverted one Windows-specific optimization that can break tests under some conditions (see #573)
This is a bugfix release that fixes a regression introduced in version 4.2.0.
This is a bugfix release that fixes a regression introduced in version 4.2.0.
open calls had not been patched for modules with a name ending with "io"
(see #569)This is an update to the performance release, with more setup caching and the possibility to disable it.
This is an update to the performance release, with more setup caching and the possibility to disable it.
use_cache option and clear_cache method to be able
to deal with unwanted side effects of the newly introduced cachingThis is mostly a performance release. The performance of the pyfakefs setup has been decreasing sufficiently, especially with the 4.x releases. This r
This is mostly a performance release. The performance of the pyfakefs setup has been decreasing sufficiently, especially with the 4.x releases. This release corrects that by making the most expansive feature optional, and by adding some other performance improvements. This shall decrease the setup time by about a factor of 20, and it shall now be comparable to the performance of the 3.4 release.
patchfs decorator now expects a positional argument instead of the
keyword arguments fs. This avoids confusion with the pytest fs
fixture and conforms to the behavior of mock.patch. You may have to
adapt the argument order if you use the patchfs and mock.patch
decorators together (see #566)patch_default_args has been added that switches this behavior on
(see #567).This is a bugfix release that fixes a regression issue.
This is a bugfix release that fixes a regression issue.
pytest (regression,
see #565)suppress deprecation warnings while collecting modules (see #542)
buffering parameter in open
(see #549)io.open_code using the new argument
patch_open_code (since Python 3.8)
(see #554)FakeFilesystem.osos.walk (see #559)home if simulating
Posix under Windows (see #558)open if called from skipped module
(see #552)pathlib.Path if called from skipped module
(see #553)additional_skip_names with several module componentsos.truncate and os.ftruncate
(see #545)Do not override global warnings setting in Deprecator (see #526)
read_csv, read_excel and more), and
for django file locks to work with the fake filesystem
(see #531)os.expanduser now works with a bytes pathDeprecator
(see #526)pathlib are patched
(see #527)This as a patch release that only builds for Python 3. Note that versions 4.0.0 and 4.0.1 will be removed from PyPI to disable installing them under P
This as a patch release that only builds for Python 3. Note that versions 4.0.0 and 4.0.1 will be removed from PyPI to disable installing them under Python 2.
Your coding agent can read these notes before it upgrades. Set up the MCP server →