NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #2332 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
This version backports some fixes from main.
This version backports some fixes from main.
lresolve / os.lstat
(see #516)os.walk if path ends with path separator
(see #512)os.makedirs
(see #510)os.TMPFILE flag under Linux
(see #509
and #511)os.makedirs in write-protected directory
(see #507)This version adds support for Python 3.7.6 and 3.8.1.
One column per quarter.
This version adds support for Python 3.7.6 and 3.8.1.
pathlib to changes in Python 3.7.6/3.8.1
(see #508) (backported from main)This version adds support for Python 3.8.
This version adds support for Python 3.8.
Note: This is the last pyfakefs version that will support Python 2.7 and Python 3.4 (possible bug fix releases notwithstanding).
os.stat_result attributes
tst_file_attributes and st_reparse_tag (see #504)os.sendfile (Posix only, Python 3 only)
(see #504)devnull in Windows under Python 3.8
(see #504)DirEntry.stat() under Windows (changed
st_nlink) (see #502)os.scandir with non-existing directory
(see #498)avoid rare side effect during module iteration in test setup (see #338)
removed unneeded parameter use_dynamic_patch
use_dynamic_patchsrc_dir_fd and dst_dir_fd arguments in os.rename,
os.replace and os.linkadditional_skip_names argument (see #482)allow_root_user to Patcher and UnitTest to allow
forcing non-root access (see #474)os.pipe (see #473)add_real_directoryadd_real_symlinkAnother bug-fix release that mainly fixes a regression with Python 2 that has been introduced in version 3.5.3.
Another bug-fix release that mainly fixes a regression with Python 2 that has been introduced in version 3.5.3.
open under Python 2 broke unit tests
(see #469)add_real_file
(see #470)FakeIOModule.open (see #471)python setup.py test under Python 2
regardless of pathlib2 presenceThis is mostly a bug-fix release.
This is mostly a bug-fix release.
pathlib did not get patched in the presence of pathlib2
(see #467)python setup.py test under Python 2import external pathlib2 and scandir packages first if present (see #462)
pathlib2 and scandir packages first if present
(see #462)removed shebang from test files to avoid packaging warnings (see #461)
added context manager class Pause for pause/resume (see #448)
This is a minor release to have a version with passing tests for OpenSUSE packaging.
This is a minor release to have a version with passing tests for OpenSUSE packaging.
from os.path import exists as my_exists, including builtin open
and io.openThis is mostly a bug-fix release.
The deprecation warnings for the old API are now switched on by default. To switch them off for legacy code, use: ```python from pyfakefs.deprecator i…
from pyfakefs.deprecator import Deprecator
Deprecator.show_warnings = False
from os.path import exists (#443)import os as _os) is now correctly
patched without the need of additional parameters
(#434)Path if imported like from pathlib import Path
(#440)patch_path has been removed from UnitTest and Patcher,
the correct patching of path imports is now done automatically
(#429)UnitTest /Patcher arguments can now also be set in setUpPyfakefs()
(#430)contents=None in create_file() as empty contents if size not
set (#424)pathlib2
support (#408) (#422)This is mostly a bug fix release, mainly for bugs found by @agroce using tstl.
This is mostly a bug fix release, mainly for bugs found by @agroce using tstl.
create_file(),
create_dir(), create_symlink(), add_real_file() and
add_real_directory() (Python >= 3.6, see #409)tell after seek gave incorrect result in append mode
(#363)readline() did not work correctly in binary mode
(#411)pathlib.Path.resolve() behaved incorrectly if the path does not exist
(#401)closed attribute was not implemented in fake file (#380)add_real_directory did not behave correctly for nested pathsos.rename (#400)os.link (#399, #407)
os.rename (#391, #395,
#396, #389,
#406)
*
os.symlink (#371, #390)
os.path.isdir (#387)open (#362, #369,
#397)
os.remove (#360, #377,
#396)
os.readlink (#359, #372,
#392)Nothing published for this version
This is a bug fix only release.
This version of pyfakefs does not support Python 2.6. Python 2.6 users must use pyfakefs 3.3 or earlier.
This version of pyfakefs does not support Python 2.6. Python 2.6 users must use pyfakefs 3.3 or earlier.
Patcher and TestCase:
os.scandir
(Python >= 3.7, Posix only) (see #346)scandir module (#332)IOError/OSError exception messages in the fake file system now always
start with the message issued in the real file system in Unix systems (
see #202)os.scandir shall not be resolved (#350)open() for Python 3, added support for universal newline mode in Python
2 (#339)flush (#302, #300)os.lstat() crashed with several trailing path
separators (#342)os.path.split() and os.path.dirname() gave incorrect results under
Windows (#335)This is the last release that supports Python 2.6.
This is the last release that supports Python 2.6.
setUp() (related
to #191).
Note that this may break test code that assumes that the fake file system is completely empty at test start.import os as '_os (#231)dir_fd argument in several os functions
(#206)os.utime,
os.chmod, os.chdir, os.chown, os.listdir, os.stat and os.lstat
(Python >= 3.3) (#205)os.open() (#204)os.path.samefile implementation (#193)ns argument in os.utime() (Python >= 3.3)
(#192)os.stat_result (Python >= 3.3)
(#196)fake_filesystem_shutil implementation, relying on the
patched os module instead (#194)fake_tempfile and fake_filesystem_glob, relying on the patched
os module
instead (#189, #191)TSTL label)
IOError vs OSError) raised in several casesrename did not behave like os.rename in many cases__init__() and setUp()
(#199)Deprecated TestCase.copyRealFile() in favor of add_real_file(). copyRealFile() remains only for backward compatibility. Also, some less-popular argume…
errors argument is supported for io.open() and os.open()add_real_file(), add_real_directory() and add_real_paths()
make real files and directories appear within the fake file system.
File contents are read from the real file system only as
needed (#170).
See example_test.py for a usage example.TestCase.copyRealFile() in favor of add_real_file().
copyRealFile() remains only for backward compatibility. Also, some
less-popular argument combinations have been disallowed.CHANGES.md, to the release manifestmox3 package is no longer a prerequisite--the portion required by pyfakefs
has been integrated into pyfakefs (#182)FakeShutilModule.rmtree() failed for directories ending with path
separator (#177)pathlib.glob() incorrectly handled case under MacOS (#167)Added helper method TestCase.copyRealFile() to copy a file from the real file system to the fake file system. This makes it easy to use template, data
TestCase.copyRealFile() to copy a file from
the real file system to the fake file system. This makes it easy to use
template, data and configuration files in your tests.fs.Support for path-like objects as arguments in fake os and os.path modules (Python >= 3.6)
os
and os.path modules (Python >= 3.6)pathlib module (Python >= 3.4) (#29)os.replace (Python >= 3.3)os.access, os.chmod, os.chown, os.stat, os.utime:
support for follow_symlinks argument (Python >= 3.3)os.scandir (Python >= 3.5) (#119)path (#53)glob.glob, glob.iglob: support for recursive argument (Python >=
3.5) (#116)glob.iglob (#59)io.open, os.open: support for encoding argument
io.open, os.open: support for encoding argument (#120)os.makedirs: support for exist_ok argument (Python >=
3.2) (#98)io.open() (#70)shutil.rmtree: support for ignore_errors and onerror
arguments (#72)os.fsync() and os.fdatasync() (#73)os.walk: Support for followlinks argumentNothing published for this version
Moved repository from GoogleCode to GitHub, merging 3 projects
fake_filesystem_unittest
(transparently patches all calls to faked implementations)os.utime fails to traverse symlinks (#49)chown incorrectly accepts non-integer uid/gid arguments (#30)fake_tempfile is using AddOpenFile incorrectly (#23)relpath, abspath and normpath on Windows.open in binary mode not working (#32)os.remove doesn't work with relative paths (#31)mkstemp returns no valid file descriptor (#19)open methods lack IOError for prohibited operations (#18)FakeFileOpen keyword args do not match the __builtin__
equivalents (#5)Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →