The released versions correspond to PyPI releases.
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)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.
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.
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
setUpClassPyfakefs
for unittest and class-scoped fixture fs_class
for pytest (see #752)False
.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 main
st_blocks
in stat result (see #722)O_TMPFILE
in os.open
(caused handling of O_DIRECTORY
as O_TMPFILE
) (see #723)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.
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.
opener
introduced in previous patch release (see #689)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.
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
)tmpdir
(and probably other fixtures) with the module-scoped version of fs
; had been introduced in pyfakefs 4.5.5 by the fix for #666 (see #684)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.
encoding
argument on binary open()
(see #664)Minor bugfix release.
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)This is a bugfix release.
os.listdir
, os.scandir
and pathlib.Path.listdir
now return the directory list in a random order (see #638)fcntl
module under Unix is now mocked, e.g. all functions have no effect (this may be changed in the future if needed, see #645)os.path.split
, os.path.splitdrive
and glob.glob
(see #632)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.
Note: This version has been yanked from PyPI as it erroneously allowed installation under Python 3.5.
pathlib.Path.hardlink_to
newline
argument in pathlib.Path.write_text
follow_symlinks
argument in pathlib.Path.stat
and pathlib.Path.chmod
os.path.realpath
pathlib2
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.
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)Another bugfix release.
os
did not reset os.sep
and related variables, fixed null device name, added os.pathsep
and missing os.path
variables (see #572)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.
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 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.
pytest
(regression, see #565)buffering
parameter in open
(see #549)io.open_code
using the new argument patch_open_code
(since Python 3.8) (see #554)FakeFilesystem.os
os.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)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 Python 2.
This as a bug fix release for a regression bug.
Note: This version has been yanked from PyPI as it erroneously allowed installation under Python 2. This has been fixed in version 4.0.2.
flask-restx
(see #523)pyfakefs 4.0.0 drops support for Python 2.7. If you still need Python 2.7, you can continue to use pyfakefs 3.7.x.
Note: This version has been yanked from PyPI as it erroneously allowed installation under Python 2. This has been fixed in version 4.0.2.
os
functionsfs
pytest fixturepatchfs
to patch single functions using the fake filesystemst_ino
in makedir
(see #515)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)pathlib
to changes in Python 3.7.6/3.8.1 (see #508)os.makedirs
in write-protected directory (see #507)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.
pathlib
to changes in Python 3.7.6/3.8.1 (see #508) (backported from main)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)use_dynamic_patch
src_dir_fd
and dst_dir_fd
arguments in os.rename
, os.replace
and os.link
additional_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_directory
add_real_symlink
os
functionsDirEntry
now implements os.PathLike
in Python >= 3.6 (see #483)os.makedirs
(see #481)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.
pathlib
did not get patched in the presence of pathlib2
(see #467)python setup.py test
under Python 2pathlib2
and scandir
packages first if present (see #462)Pause
for pause/resume (see #448)AttributeError
shown while displaying fs
in a failing pytest in Python 2AttributeError
triggered by modules without __module__
attribute (see #460)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.open
This is mostly a bug-fix release.
st_uid
and st_gid
in new files (#449)modules_to_patch
(regression, see #450)add_real_directory
(#446)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)shutil
functions using zipfile
(#427)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.rmdir
(#398)os.mkdir
, os.makedirs
(#396)os.rename
(#391, #395, #396, #389, #406)os.symlink
(#371, #390)os.path.isdir
(#387)open
(#362, #369, #397)os.path.lexists
, os.path.islink
(#365, #373, #396)os.remove
(#360, #377, #396)os.stat
(#376)os.path.isfile
(#374)os.path.getsize
(#368)os.lstat
(#366)os.path.exists
(#364)os.readlink
(#359, #372, #392)This is a bug fix only release.
tempfile
after test execution (regression, see #356)add_real_directory
does not work after chdir
(see #355)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.
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)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)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
.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)shutil.move
incorrectly moves directories (#145)open
(Python >= 3.3) (#147)Patcher
with py.test (#135)os.listdir
returned sorted instead of unsorted entriesio.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
argumentshutil
functions like make_archive
do not work with pyfakefs (#104)shutil.copy
error with bytes contents (#105)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)There are no release notes for releases 2.6 and below. The following versions are still available on PyPI: