The released versions correspond to PyPI releases.
pyfakefs versions follow Semantic Versioning.
Version 6.2.0 (2026-04-12)
Changes the MRO for file wrappers.
- fake file wrappers now derive from
io.TextIOBaseorio.BufferedIOBase, so thatisinstance-checks for these classes succeed (see #1307 and #484)
- route some pseudo-devices to the system instead of patching them; this ensures
that
os.urandomand related functions work correctly with PyPy (see #1300) - fake file
seekmethod did not return the location in the file (see #1304) - make sure case sensitivity is correctly set for fake posix paths
in
hash(),Path.matchandPath.full_match(see #1308)
- use newest
pytestfor testing in CI
Version 6.1.6 (2026-03-18)
Follow-up bugfix release for 6.1.5.
os.path.realpathdid not correctly handle some absolute paths under Windows (previous fix was incomplete, see #1296)
Version 6.1.5 (2026-03-15)
Minor bugfix release.
os.path.realpathdid not resolve symlinks under Windows (see #1296)
Version 6.1.4 (2026-03-04)
Fixes incompatibility with VCCode unittest runner.
expandusernow correctly handles paths besides home and different separators (see #1289)- avoid faking filesystem in VSCode unittest runner (see #1285)
Version 6.1.3 (2026-03-01)
Minor bugfix release.
- handle
expanduser()andhome()correctly in cross OS usage (see #1289)
Version 6.1.2 (2026-02-22)
Fixes a regression caused by the introduced weakrefs.
- do not use weakrefs for filesystem objects in fake modules (see #1284)
Version 6.1.1 (2026-02-09)
Fixes a packaging issue in latest version.
- fixed packaging issue: tests had not been added to sdist (see #1278)
Version 6.1.0 (2026-02-06)
Changes back-link references to weak references.
- added more support for PyPy 3
- Caution: many back-link references have been replaced by weak references; this may have unwanted consequences (crashes) for some untested workflows
- added PyPy 3.11 to CI, added PyPy builds for all OSes
- use only
pyproject.tomlfor dependencies, movedtoxconfiguration intopyproject.toml
- fixed a problem accessing
sizefrom aFakeFileWrapperobject (see #1276) - fixed a problem with
readableraising an error on a file object. (see #1265) - avoid memory accumulation in consecutive tests by using weak references (see #1267)
Version 6.0.0 (2025-12-21)
Removes some deprecated functionality, removes support for Python < 3.10.
- removed support for Python versions < 3.10; patch releases based on
pyfakefs5.10 supporting older versions may be made on demand - removed support for patching legacy modules
scandirandpathlib2 - changed the default for
FakeFilesystem.shuffle_listdir_resultstoTrueto reflect the real filesystem behavior
- added some support for Python 3.15a3
- fixes a problem with
Pathtype hints using the pipe symbol in wrapped functions inside anfsdependent fixture (see #1242) - fixes problem with new
coveragein Python 3.14 using the fake filesystem (see #1245)
- added project information to documentation pages
- added CI tests for Python 3.15
Version 5.10.2 (2025-11-04)
Fixes a problem with pathlib.glob in Python 3.14.
- fixed
pathlib.glob()for Python 3.14 (see #1239)
Version 5.10.1 (2025-10-27)
Fixes a regression introduced in version 5.9.0.
- fixed a deadlock in
shutil.copytreeif copying using anshutilfunction ascopy_functionargument (see #1235)
Version 5.10.0 (2025-10-11)
Adds official support for Python 3.14. Last minor version before the 6.0 release.
- the
errnocodes set inOSErrorhave changed for some specific error conditions in Windows 11/Windows Server 2025; pyfakefs now matches this behavior instead of the previous behavior under Windows 10 - added official support for Python 3.14
- added support for
os.readintoin Python 3.14 - added support for
pathlib.copyandpathlib.copy_intoin Python 3.14
- fixes patching of Debian-specific
tempfilein Python 3.13 (see #1214)
Version 5.9.3 (2025-08-28)
Fixes a utility method.
- 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 fake filesystem is used)
- fixed
fake_filesystem.add_package_metadatathat had never worked correctly (see #1205)
- updated the package build-system minimum version to setuptools v61.2 and higher
Version 5.9.2 (2025-07-30)
Fixes interaction with pytest.
- fixed an interaction problem of
fswith other pytest fixtures (see #1200)
- fixed some warnings in tests (see #1190)
Version 5.9.1 (2025-06-23)
Fixes regression in packaging in version 5.9.0.
- fixed handling of added
strictargument in Python 3.9.23 - make sure test files are packaged (see #1186)
Version 5.9.0 (2025-06-21)
Adds support for an API change in latest Python patch releases.
- the message from an
OSErrorraised in the fake filesystem has no longer the postfix "in the fake filesystem" (see #1159) - changed implementation of
FakeShutilModuleto prepare it for usage without the patcher (see #1171)
- added convenience function
add_package_metadatato add the metadata of a given package to the fake filesystem (see #1155)
- fixed handling of dynamic imports from code in the fake filesystem in Python > 3.11 (see #1121)
- fixed workaround for recursion with pytest under Windows to ignore capitalization of pytest executable (see #1096)
- added missing
modeproperty to fake file wrapper (see #1162) - fixed instantiation of a standalone
FakePathlibModulefor Python >= 3.11 (see #1169) - added support for new value "ALLOW_MISSING" of
strictargument inos.path.realpath(introduced in latest patch version of Python >= 3.10, see #1180)
- adapt test for increased default buffer size in Python 3.14a6
- replace session-scoped with module-scoped fixture in test, run pytest over all tests in docker containers (see #1151)
- remove
setup.pyandsetup.cfgin favor ofpyproject.toml
Version 5.8.0 (2025-03-11)
Adds preliminary support for Python 3.14.
- added some preliminary support for Python 3.14
- change behavior of
FakeFilesystem.get_object()to ignore permissions as it has been before version 5.4.0 (see #1122)
- fixed a problem with flushing if writing over the buffer end (see #1120)
- fixed a regression that could break tests under Posix in Python 3.12 (see #1126)
- fixed behavior for
os.accessfor symlinks under Windows - fixed permission problem on querying file properties (see #1122)
- fixed patching in pytest setup phase for module and session-scoped fs fixtures (see #1126)
- use a theme for documentation supporting dark mode
Version 5.7.4 (2025-01-14)
Minor bugfix release.
- fixed a problem with module and session scoped fixtures in Python 3.13 (see #1101)
- fixed handling of
cwdif set to apathlib.Path(see #1108) - fixed documentation for cleanup handlers, added convenience handler
reload_cleanup_handler(see #1105)
Version 5.7.3 (2024-12-15)
Fixes a regression in version 5.7.3.
- fixed a regression in version 5.7.2 that
tempfilewas not patched after pause/resume (POSIX only, see #1098) - added workaround for a recursion occurring if using pytest under Windows and Python >= 3.12 (see #1096)
- run pytest-specific tests for all supported Python versions
- pytest is only supported for versions >= 6.2.5, earlier version do not work in Python >= 3.10 due to a pytest issue - adapted tests and documentation
Version 5.7.2 (2024-12-01)
Fixes some problems with patching.
- added some support for loading fake modules in
AUTOpatch mode usingimportlib.import_module(see #1079) - added some support to avoid patching debugger related modules (see #1083)
- avoid reloading
tempfilein Posix systems
- use trusted publisher for release (see https://docs.pypi.org/trusted-publishers/)
Version 5.7.1 (2024-08-13)
Fixes a regression in version 5.7.0 that broke patching fcntl.
- fixes a regression that caused unfaked
fcntlcalls to fail (see #1074)
Version 5.7.0 (2024-08-10)
Adds official Python 3.13 support, improves OS emulation behavior.
- officially support Python 3.13
- the
additional_skip_namesparameter now works with more modules (see #1023) - added support for
os.fchmod, allow file descriptor argument foros.chmodonly for POSIX for Python < 3.13
- avoid reloading
globin Python 3.13
- removing files while iterating over
scandirresults is now possible (see #1051) - fake
pathlib.PosixPathandpathlib.WindowsPathnow behave more like in the real filesystem (see #1053) PurePosixPathreported 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)
Version 5.6.0 (2024-07-12)
Adds preliminary Python 3.13 support.
- added preliminary support for Python 3.13 (tested with beta2) (see #1017)
- added
apply_umaskargument toFakeFilesystem.create_dirto allow ignoring the umask (see #1038)
- use real open calls for remaining
pathlibfunctions so that it works nice with skippedmodules (see #1012)
- Add pyupgrade as a pre-commit hook.
Version 5.5.0 (2024-05-12)
Deprecates the usage of pathlib2 and scandir.
- The usage of the
pathlib2andscandirmodules 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. PureWindowsPathandPurePosixPathnow 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 handling of Windows
pathlibpaths under POSIX and vice verse (see #1006) - correctly use real open calls in pathlib for skipped modules (see #1012)
Version 5.4.1 (2024-04-11)
Fixes a regression.
- fixed a regression from version 5.4.0 that incorrectly handled files opened twice via file descriptor (see #997)
Version 5.4.0 (2024-04-07)
Improves permission handling.
- 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
- removed the argument
module_cleanup_mode, that was introduced as a temporary workaround in the previous version - related problems shall be handled using a cleanup handler
- added support for
O_NOFOLLOWandO_DIRECTORYflags inos.open(see #972 and #974) - added support for fake
os.dup,os.dup2andos.lseek(see #970)
- fixed a specific problem on reloading a pandas-related module (see #947), added possibility for unload hooks for specific modules
- use this also to reload django views (see #932)
- fixed
EncodingWarningfor Python >= 3.11 (see #957) - consider directory ownership while adding or removing directory entries (see #959)
- fixed handling of directory enumeration and search permissions under Posix systems (see #960)
- fixed creation of the temp directory in the fake file system after a filesystem reset (see #965)
- fixed handling of
dirfdinos.symlink(see #968) - add missing
follow_symlinkargument toos.link(see #973) - fixed handling of missing attribute in
os.getxattr(see #971) - fixed permission problem with
shutil.rmtreeif emulating Windows under POSIX (see #979) - fixed handling of errors on opening files via file descriptor (see #967)
- fixed handling of
umask- it is now applied by default - fixed behavior of
os.makedirs(see #987)
- replace
undefinedby own minimal implementation to avoid importing it (see #981)
Version 5.3.5 (2024-01-30)
Fixes a regression.
- 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
djangomodule is loaded, and the behavior can be changed using the new argumentmodule_cleanup_mode.
- included
tox.iniand a few more files into the source distribution (see #937)
Version 5.3.4 (2024-01-19)
Bugfix release.
- fixed handling of unhashable modules which cannot be cached (see #923)
- reload modules loaded by the dynamic patcher instead of removing them - sometimes they may not be reloaded automatically (see #932)
- added back argument
use_dynamic_patchas a fallback for similar problems
Version 5.3.2 (2023-11-30)
Bugfix release.
- fixed a problem with patching
_iounder Python 3.12 (see #910) - fixed a problem with accessing the temp path if emulating Linux under Windows (see #912)
- fixed result of
os.walkwith a path-like top directory (see #915) - properly fixed the problem that filesystem patching was still active in the pytest logreport phase (see #904), the previous fix was incomplete
Version 5.3.1 (2023-11-15)
Mostly a bugfix release.
- changed behavior of
add_real_directoryto be able to map a real directory to an existing directory in the fake filesystem (see #901)
- fixed the problem that filesystem patching was still active in the pytest logreport phase (see #904)
- restored compatibility with PyTorch 2.0 and above, as well as with other classes that have custom setattr methods (see #905)
Version 5.3.0 (2023-10-11)
Adds official support for Python 3.12.
- added official support for Python 3.12
- removed a leftover debug print statement (see #869)
- make sure tests work without HOME environment set (see #870)
- automount drive or UNC path under Windows if needed for
pathlib.Path.mkdir()(see #890) - adapted patching
io.openandio.open_codeto work with Python 3.12 (see #836 and #892)
Version 5.2.4 (2023-08-18)
Fixes a rare problem on pytest shutdown.
- Clear the patched module cache on session shutdown (pytest only)
(see #866). Added a class method
Patcher.clear_fs_cachefor clearing the patched module cache.
Version 5.2.3 (2023-07-10)
Adds compatibility with PyPy 3.10 and Python 3.12.
- Re-create temp directory if it had been created before on resetting file system (see #814).
- Excluded pytest
pathlibmodules from patching to avoid mixup of patched/unpatched code (see #814). - Adapted to changes in Python 3.12 beta1 (only working partially, see #830 and #831).
- Adapted to changes in
shutilin Python 3.12 beta2 (see #814). - Fixed support for newer PyPi versions (see #859).
- Added a note regarding the incompatibility of the built-in
sqlite3module withpyfakefs(see #850)
- Added pytype check for non-test modules in CI (see #599).
- Added tests for different pypy3 versions.
- Added codespell hook to pre-commit
Version 5.2.2 (2023-04-13)
Fixes a regression in 5.2.0
- Made the user and group IDs accessible via dedicated
get_uidandget_gidfunctions (for symmetry toset_uid/set_gid)
- The test fixture is now included in the source distribution and installed with the package.
- Some public constants in
fake_filesystemthat had been moved tohelpersare made accessible from there again (see #809). - Add missing fake implementations for
os.getuidandos.getgid(Posix only) - Make sure a
/tmppath exists under linux (TMPDIRmay point elsewhere) (see #810)
Version 5.2.1 (2023-04-11)
Support for latest Python 3.12 version.
- Adapted fake pathlib to changes in Python 3.12a7 (last alpha version)
- Properties defining the capabilities of some
osfunctions likeos.supports_follow_symlinksare now properly faked to contain the fake functions if the real functions are faked (see #799)
Version 5.2.0 (2023-03-31)
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 module classes previously defined in
fake_filesystemhave now moved to their own modules:fake_os.FakeOsModule,fake_path.FakePathModule,fake_io.FakeIoModuleandfake_open.FakeFileOpen. Additionally, all fake file classes have been moved tofake_file. While most of the changes shall be upwards compatible, we cannot exclude that we missed some problems. - Under macOS, at test start a symlink
/tmpto the actual temporary directory is now created in the fake filesystem. - Patching of parsers for pandas >= 1.2 is removed since pandas now uses Python fs functions internally even when the engine selected is "c".
- added possibility to set a path inaccessible under Windows by using
chown()with theforce_unix_modeflag (see #720) - added support for current Python 3.12 version (alpha 6)
- added support for
os.path.splitroot(new in Python 3.12)
Version 5.1.0 (2023-01-12)
New version before Debian freeze
- added class level setup method
setUpClassPyfakefsfor unittest and class-scoped fixturefs_classfor pytest (see #752) - added experimental support for Python 3.12: added fake APIs for Windows junction
support. These are not implemented and always return
False.
- replaced end-of-life CentOS with RedHat UBI9 docker image
- added tests for pytest 7.2.0
- added black to pre-commit checks, which caused some changes to the coding style (max line length is now 88, always use double quotes)
- added Python 3.12 to the test suite.
- migrated to setuptools declarative syntax.
- fixed docker tests when running on branches containing forward slashes
Version 5.0.0 (2022-10-09)
New version after the transfer to pytest-dev.
- the old-style API deprecated since version 3.4 has now been removed
- the method
copyRealFiledeprecated since version 3.2 has been removed - useadd_real_fileinstead
- transferred the repository to the
pytest-devorganization - renamed the
masterbranch tomain - added automatic PyPI release workflow
- move documentation from GitHub Pages to Read the Docs
- added some support for
st_blocksin stat result (see #722)
- fixed handling of
O_TMPFILEinos.open(caused handling ofO_DIRECTORYasO_TMPFILE) (see #723) - fixed handling of read permissions (see #719)
Version 4.7.0 (2022-09-18)
Changed handling of nested fixtures and bug fixes.
fsfixtures cannot be nested; any nestedfsfixture (for example inside anfs_sessionorfs_modulefixture) will just reference the outer fixture (the behavior had been unexpected before)
- reverted a performance optimization introduced in version 3.3.0 that caused hanging tests with installed torch (see #693)
- do not use the built-in opener in
pathlibas it may cause problems (see #697) - add support for path-like objects in
shutil.disk_usage(see #699) - do not advertise support for Python 3.6 in
setup.py(see #707) - return the expected type from
fcntl.ioctlandfcntl.fcntlcalls ifargis of typebyte; the call itself does nothing as before - do not skip filesystem modules by name to allow using own modules with the same name (see #707)
- add missing support for
os.renames(see #714)
Version 4.6.3 (2022-07-20)
Another patch release that fixes a regression in version 4.6.
-
automatically reset filesystem on changing
is_windows_fsoris_macos(see #692) - ensures better upwards compatibility in most cases⚠️ Make sure you write to the filesystem after you changeis_windows_fsoris_macos, otherwise the changes will be lost.
- fixed regression:
os.path.existsreturnedTruefor any root drive path under Windows
Version 4.6.2 (2022-07-14)
Patch release that fixes an error in the previous patch.
- fixed support for
openerintroduced in previous patch release (see #689)
Version 4.6.1 (2022-07-13)
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.
- added support for
openerargument inopen, which is used intempfilein Python 3.11 since beta 4 (see #686)
- make sure tests run without
pyfakefsinstalled as a package (see #687)
Version 4.6.0 (2022-07-12)
Adds support for Python 3.11, removes support for Python 3.6, changes root path behavior under Windows.
- Python 3.6 has reached its end of life on 2021/12/23 and is no
longer officially supported by pyfakefs
os.stat_float_timeshas been removed in Python 3.7 and is therefore no longer supported
- under Windows, the root path is now effectively
C:\instead of\; a path starting with\points to the current drive as in the real file system (see #673) - fake
pathlib.Path.owner()andpathlib.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)
- added some support for the upcoming Python version 3.11 (see #677)
- added convenience fixtures for module- and session based
fsfixtures (fs_moduleandfs_session)
- fixed an incompatibility of
tmpdir(and probably other fixtures) with the module-scoped version offs; had been introduced in pyfakefs 4.5.5 by the fix for #666 (see #684)
Version 4.5.6 (2022-03-17)
Fixes a regression which broke tests with older pytest versions (< 3.9).
- minimum supported pytest version is now 3.0 (older versions do not work properly with current Python versions)
- only skip
_pytest.pathlibin pytest versions where it is actually present (see #669)
- add tests with different pytest versions, starting with 3.0
Version 4.5.5 (2022-02-14)
Bugfix release, needed for compatibility with pytest 7.0.
- correctly handle file system space for files opened in write mode (see #660)
- correctly handle reading/writing pipes via file (see #661)
- disallow
encodingargument on binaryopen()(see #664) - fixed compatibility issue with pytest 7.0.0 (see #666)
Version 4.5.4 (2022-01-12)
Minor bugfix release.
Version 4.5.3 (2021-11-08)
Reverts a change in the previous release that could cause a regression.
os.listdir,os.scandirandpathlib.Path.listdirnow return the directory list in a random order only if explicitly configured in the file system (usefs.shuffle_listdir_results = Truewithfsbeing the file system). In a future version, the default may be changed to better reflect the real filesystem behavior (see #647)
Version 4.5.2 (2021-11-07)
This is a bugfix release.
os.listdir,os.scandirandpathlib.Path.listdirnow return the directory list in a random order (see #638)- the
fcntlmodule under Unix is now mocked, e.g. all functions have no effect (this may be changed in the future if needed, see #645)
- fixed handling of alternative path separator in
os.path.split,os.path.splitdriveandglob.glob(see #632) - fixed handling of failed rename due to permission error (see #643)
Version 4.5.1 (2021-08-29)
This is a bugfix release.
- added handling of path-like where missing
- improved handling of
str/bytespaths - suppress all warnings while inspecting loaded modules (see #614)
- do not import pandas and related modules if it is not patched (see #627)
- handle
pathlib.Path.owner()andpathlib.Path.groupby returning the current user/group name (see #629) - fixed handling of
use_known_patches=False(could cause an exception) - removed Python 3.5 from metadata to disable installation for that version (see #615)
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.
- added support for some Python 3.10 features:
- new method
pathlib.Path.hardlink_to - new
newlineargument inpathlib.Path.write_text - new
follow_symlinksargument inpathlib.Path.statandpathlib.Path.chmod - new 'strict' argument in
os.path.realpath
- new method
- Python 3.5 has reached its end of life in September 2020 and is no longer supported
pathlib2is still supported, but considered to have the same functionality aspathliband is no longer tested separately; the previous behavior broke newerpathlibfeatures ifpathlib2was installed (see #592)
- correctly handle byte paths in
os.path.exists(see #595) - Update
fake_pathlibto support changes coming in Python 3.10 (see - correctly handle UNC paths in
os.path.splitand in directory path evaluation (see #606)
- added mypy checks in CI (see #599)
Version 4.4.0 (2021-02-24)
Adds better support for Python 3.8 / 3.9.
- added support for
pathlib.Path.link_to(new in Python 3.8) (see #580) - added support for
pathlib.Path.readlink(new in Python 3.9) (see #584) - added
FakeFilesystem.create_linkconvenience method which creates intermittent directories (see #580)
- fixed handling of pipe descriptors in the fake filesystem (see #581)
- added non-functional argument
effective_idstoos.access(see #585) - correctly handle
os.filefor unreadable files (see #588)
- added automatic documentation build and check-in
Version 4.3.3 (2020-12-20)
Another bugfix release.
- Reverted one Windows-specific optimization that can break tests under some conditions (see #573)
- Setting
osdid not resetos.sepand related variables, fixed null device name, addedos.pathsepand missingos.pathvariables (see #572)
Version 4.3.2 (2020-11-26)
This is a bugfix release that fixes a regression introduced in version 4.2.0.
opencalls had not been patched for modules with a name ending with "io" (see #569)
Version 4.3.1 (2020-11-23)
This is an update to the performance release, with more setup caching and the possibility to disable it.
- Added caching of patched modules to avoid lookup overhead
- Added
use_cacheoption andclear_cachemethod to be able to deal with unwanted side effects of the newly introduced caching
- Moved CI builds to GitHub Actions for performance reasons
Version 4.3.0 (2020-11-19)
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.
- The
patchfsdecorator now expects a positional argument instead of the keyword argumentsfs. This avoids confusion with the pytestfsfixture and conforms to the behavior ofmock.patch. You may have to adapt the argument order if you use thepatchfsandmock.patchdecorators together (see #566) - Default arguments that are file system functions are now not patched by
default to avoid a large performance impact. An additional parameter
patch_default_argshas been added that switches this behavior on (see #567).
- Added performance improvements in the test setup, including caching the unpatched modules
Version 4.2.1 (2020-11-02)
This is a bugfix release that fixes a regression issue.
- remove dependency of pyfakefs on
pytest(regression, see #565)
Version 4.2.0 (2020-11-01)
- add support for the
bufferingparameter inopen(see #549) - add possibility to patch
io.open_codeusing the new argumentpatch_open_code(since Python 3.8) (see #554) - add possibility to set file system OS via
FakeFilesystem.os
- fix check for link in
os.walk(see #559) - fix handling of real files in combination with
homeif simulating Posix under Windows (see #558) - do not call fake
openif called from skipped module (see #552) - do not call fake
pathlib.Pathif called from skipped module (see #553) - fixed handling of
additional_skip_nameswith several module components - allow to open existing pipe file descriptor (see #493)
- do not truncate file on failed flush (see #548)
- suppress deprecation warnings while collecting modules (see #542)
- add support for
os.truncateandos.ftruncate(see #545)
- fixed another problem with CI test scripts not always propagating errors
- make sure pytest will work without pyfakefs installed (see #550)
Version 4.1.0 (2020-07-12)
- Added some support for pandas (
read_csv,read_exceland more), and for django file locks to work with the fake filesystem (see #531)
os.expandusernow works with a bytes path- Do not override global warnings setting in
Deprecator(see #526) - Make sure filesystem modules in
pathlibare patched (see #527) - Make sure that alternative path separators are correctly handled under Windows (see #530)
- Make sure all temporary files from real fs tests are removed
Version 4.0.2 (2020-03-04)
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.
- Do not build for Python 2 (see #524)
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.
- Avoid exception if using
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.
- Removed Python 2.7 and 3.4 support (see #492)
- Added support for handling keyword-only arguments in some
osfunctions - Added possibility to pass additional parameters to
fspytest fixture - Added automatic patching of default arguments that are file system functions
- Added convenience decorator
patchfsto patch single functions using the fake filesystem
- Added missing
st_inoinmakedir(see #515) - Fixed handling of relative paths in
lresolve/os.lstat(see #516) - Fixed handling of byte string paths (see #517)
- Fixed
os.walkif path ends with path separator (see #512) - Fixed handling of empty path in
os.makedirs(see #510) - Fixed handling of
os.TMPFILEflag under Linux (see #509 and #511) - Adapted fake
pathlibto changes in Python 3.7.6/3.8.1 (see #508) - Fixed behavior of
os.makedirsin write-protected directory (see #507)
Version 3.7.2 (2020-03-02)
This version backports some fixes from main.
- Fixed handling of relative paths in
lresolve/os.lstat(see #516) - Fixed
os.walkif path ends with path separator (see #512) - Fixed handling of empty path in
os.makedirs(see #510) - Fixed handling of
os.TMPFILEflag under Linux (see #509 and #511) - Fixed behavior of
os.makedirsin write-protected directory (see #507)
Version 3.7.1 (2020-02-14)
This version adds support for Python 3.7.6 and 3.8.1.
- Adapted fake
pathlibto changes in Python 3.7.6/3.8.1 (see #508) (backported from main)
Version 3.7 (2019-11-23)
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).
- added support for Python 3.8 (see #504)
- added preliminary support for Windows-specific
os.stat_resultattributestst_file_attributesandst_reparse_tag(see #504) - added support for fake
os.sendfile(Posix only, Python 3 only) (see #504)
- support
devnullin Windows under Python 3.8 (see #504) - fixed side effect of calling
DirEntry.stat()under Windows (changed st_nlink) (see #502) - fixed problem of fake modules still referenced after a test in modules loaded during the test (see #501 and #427)
- correctly handle missing read permission for parent directory (see #496)
- raise for
os.scandirwith non-existing directory (see #498)
- fixed CI tests scripts to always propagate errors (see #500)
Version 3.6.1 (2019-10-07)
- avoid rare side effect during module iteration in test setup (see #338)
- make sure real OS tests are not executed by default (see #495)
Version 3.6 (2019-06-30)
- removed unneeded parameter
use_dynamic_patch
- support for
src_dir_fdanddst_dir_fdarguments inos.rename,os.replaceandos.link - added possibility to use modules instead of module names for the
additional_skip_namesargument (see #482) - added argument
allow_root_usertoPatcherandUnitTestto allow forcing non-root access (see #474) - added basic support for
os.pipe(see #473) - added support for symlinks in
add_real_directory - added new public method
add_real_symlink
- added check for correctly installed Python 3 version in Travis.CI (see #487)
- fixed incorrect argument names for some
osfunctions - fake
DirEntrynow implementsos.PathLikein Python >= 3.6 (see #483) - fixed incorrect argument name for
os.makedirs(see #481) - avoid pytest warning under Python 2.7 (see #466)
- add next to FakeFileWrapper (see #485)
Version 3.5.8 (2019-06-21)
Another bug-fix release that mainly fixes a regression with Python 2 that has been introduced in version 3.5.3.
- regression: patching built-in
openunder Python 2 broke unit tests (see #469) - fixed writing to file added with
add_real_file(see #470) - fixed argument name of
FakeIOModule.open(see #471)
- more changes to run tests using
python setup.py testunder Python 2 regardless ofpathlib2presence
Version 3.5.7 (2019-02-08)
This is mostly a bug-fix release.
- regression:
pathlibdid not get patched in the presence ofpathlib2(see #467) - fixed errors if running the PyCharm debugger under Python 2 (see #464)
- do not run real file system tests by default (fixes deployment problem, see #465)
- make tests run if running
python setup.py testunder Python 2
Version 3.5.6 (2019-01-13)
- import external
pathlib2andscandirpackages first if present (see #462)
Version 3.5.5 (2018-12-20)
- removed shebang from test files to avoid packaging warnings (see #461)
Version 3.5.4 (2018-12-19)
- added context manager class
Pausefor pause/resume (see #448)
- fixed
AttributeErrorshown while displayingfsin a failing pytest in Python 2 - fixed permission handling for root user
- avoid
AttributeErrortriggered by modules without__module__attribute (see #460)
Version 3.5.3 (2018-11-22)
This is a minor release to have a version with passing tests for OpenSUSE packaging.
- automatically patch file system methods imported as another name like
from os.path import exists as my_exists, including builtinopenandio.open
- make tests for access time less strict to account for file systems that do not change it immediately (#453)
Version 3.5.2 (2018-11-11)
This is mostly a bug-fix release.
- added support for pause/resume of patching the file system modules (#448)
- allow to set current group ID, set current user ID and group ID as
st_uidandst_gidin new files (#449)
- fixed using
modules_to_patch(regression, see #450) - fixed recursion error on unpickling the fake file system (#445)
- allow trailing path in
add_real_directory(#446)
Version 3.5 (2018-10-22)
- This version of pyfakefs does not support Python 3.3. Python 3.3 users must keep using pyfakefs 3.4.3, or upgrade to a newer Python version.
- The deprecation warnings for the old API are now switched on by default.
To switch them off for legacy code, use:
from pyfakefs.deprecator import Deprecator Deprecator.show_warnings = False
- Improved automatic patching:
- automatically patch methods of a patched file system module imported like
from os.path import exists(#443) - a module imported as another name (
import os as _os) is now correctly patched without the need of additional parameters (#434) - automatically patch
Pathif imported likefrom pathlib import Path(#440) - parameter
patch_pathhas been removed fromUnitTestandPatcher, the correct patching ofpathimports is now done automatically (#429) UnitTest/Patcherarguments can now also be set insetUpPyfakefs()(#430)
- automatically patch methods of a patched file system module imported like
- added possibility to set user ID (#431)
- added side_effect option to fake files (#433)
- added some support for extended filesystem attributes under Linux (#423)
- handle
contents=Noneincreate_file()as empty contents if size not set (#424) - added
pathlib2support (#408) (#422) - added support for null device (#418)
- improved error message for "Bad file descriptor in fake filesystem" (#419)
- fixed pytest when both pyfakefs and future are installed (#441)
- file timestamps are now updated more according to the real behavior (#435)
- fixed a problem related to patching
shutilfunctions usingzipfile(#427)
Version 3.4.3 (2018-06-13)
This is mostly a bug fix release, mainly for bugs found by @agroce using tstl.
- added support for path-like objects as arguments in
create_file(),create_dir(),create_symlink(),add_real_file()andadd_real_directory()(Python >= 3.6, see #409)
- moved tests into package
- use README.md in pypi (#358)
tellafterseekgave incorrect result in append mode (#363)- a failing pytest did not display the test function correctly (#381)
- flushing file contents after truncate was incorrect under some conditions (#412)
readline()did not work correctly in binary mode (#411)pathlib.Path.resolve()behaved incorrectly if the path does not exist (#401)closedattribute was not implemented in fake file (#380)add_real_directorydid not behave correctly for nested paths- the following functions did not behave correctly for paths ending with a
path separator (found by @agroce using tstl):
os.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)
Version 3.4.1 (2018-03-18)
This is a bug fix only release.
- Missing cleanup after using dynamic patcher let to incorrect behavior of
tempfileafter test execution (regression, see #356) add_real_directorydoes not work afterchdir(see #355)
Version 3.4 (2018-03-08)
This version of pyfakefs does not support Python 2.6. Python 2.6 users must use pyfakefs 3.3 or earlier.
- Added possibility to map real files or directories to another path in the fake file system (see #347)
- Configuration of
PatcherandTestCase: - Added support for file descriptor path parameter in
os.scandir(Python >= 3.7, Posix only) (see #346) - Added support to fake out backported
scandirmodule (#332) IOError/OSErrorexception messages in the fake file system now always start with the message issued in the real file system in Unix systems (see #202)
- Changed API to be PEP-8 conform (#186). Note: The old API is still available.
- Removed Python 2.6 support (#293)
- Added usage documentation to GitHub Pages
- Added contributing guide
- Added flake8 tests to Travis CI
- Links in base path in
os.scandirshall not be resolved (#350) - Fixed unit tests when run on a computer not having umask set to 0022
- Correctly handle newline parameter in
open()for Python 3, added support for universal newline mode in Python 2 (#339) - Fixed handling of case-changing rename with symlink under MacOS (#322)
- Creating a file with a path ending with path separator did not raise (#320)
- Fixed more problems related to
flush(#302, #300) - Correctly handle opening files more than once (#343)
- Fake
os.lstat()crashed with several trailing path separators (#342) - Fixed handling of path components starting with a drive letter(#337)
- Symlinks to absolute paths were incorrectly resolved under Windows (#341)
- Unittest mock didn't work after setUpPyfakefs (#334)
os.path.split()andos.path.dirname()gave incorrect results under Windows (#335)
Version 3.3 (2017-11-12)
This is the last release that supports Python 2.6.
- The OS specific temp directory is now automatically created in
setUp()(related to #191). Note that this may break test code that assumes that the fake file system is completely empty at test start. - Added possibility to reload modules and switch on dynamic loading of modules after setup (experimental, see #248)
- Added possibility to patch modules that import file system modules under
another name, for example
import os as '_os(#231) - Added support for
dir_fdargument in severalosfunctions (#206) - Added support for open file descriptor as path argument in
os.utime,os.chmod,os.chdir,os.chown,os.listdir,os.statandos.lstat(Python >= 3.3) (#205) - Added support for basic modes in fake
os.open()(#204) - Added fake
os.path.samefileimplementation (#193) - Added support for
nsargument inos.utime()(Python >= 3.3) (#192) - Added nanosecond time members in
os.stat_result(Python >= 3.3) (#196)
- Added Travis CI tests for MacOSX (Python 2.7 and 3.6)
- Added Appveyor CI tests for Windows (Python 2.7, 3.3 and 3.6)
- Added auto-generated documentation for development version on GitHub Pages
- Removed most of
fake_filesystem_shutilimplementation, relying on the patchedosmodule instead (#194) - Removed
fake_tempfileandfake_filesystem_glob, relying on the patchedosmodule instead (#189, #191)
- Multiple fixes of bugs found using TSTL by @agroce (see about 100 issues
with the
TSTLlabel)- several problems with buffer handling in high-level IO functions
- several problems with multiple handles on the same file
- several problems with low-level IO functions
- incorrect exception (
IOErrorvsOSError) raised in several cases - Fake
renamedid not behave likeos.renamein many cases - Symlinks have not been considered or incorrectly handled in several functions
- A nonexistent file that has the same name as the content of the parent object was seen as existing
- Incorrect error handling during directory creation
- many fixes for OS-specific behavior
- Also patch modules that are loaded between
__init__()andsetUp()(#199) - Creating files in read-only directory was possible (#203)
Version 3.2 (2017-05-27)
- The
errorsargument is supported forio.open()andos.open() - New methods
add_real_file(),add_real_directory()andadd_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). Seeexample_test.pyfor a usage example. - Deprecated
TestCase.copyRealFile()in favor ofadd_real_file().copyRealFile()remains only for backward compatibility. Also, some less-popular argument combinations have been disallowed. - Added this file you are reading,
CHANGES.md, to the release manifest
- The
mox3package is no longer a prerequisite--the portion required by pyfakefs has been integrated into pyfakefs (#182)
- Corrected the handling of byte/unicode paths in several functions (#187)
FakeShutilModule.rmtree()failed for directories ending with path separator (#177)- Case was incorrectly handled for added Windows drives
pathlib.glob()incorrectly handled case under MacOS (#167)- tox support was broken (#163)
- On Windows it was not possible to rename a file when only the case of the file name changed (#160)
Version 3.1 (2017-02-11)
- 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 and configuration files in your tests. - A pytest plugin is now installed with pyfakefs that exports the
fake filesystem as pytest fixture
fs.
- Incorrect disk usage calculation if too large file created (#155)
Version 3.0 (2017-01-18)
- Support for path-like objects as arguments in fake
osandos.pathmodules (Python >= 3.6) - Some changes to make pyfakefs work with Python 3.6
- Added fake
pathlibmodule (Python >= 3.4) (#29) - Support for
os.replace(Python >= 3.3) os.access,os.chmod,os.chown,os.stat,os.utime: support forfollow_symlinksargument (Python >= 3.3)- Support for
os.scandir(Python >= 3.5) (#119) - Option to not fake modules named
path(#53) glob.glob,glob.iglob: support forrecursiveargument (Python >= 3.5) (#116)- Support for
glob.iglob(#59)
shutil.moveincorrectly moves directories (#145)- Missing support for 'x' mode in
open(Python >= 3.3) (#147) - Incorrect exception type in Posix if path ancestor is a file (#139)
- Exception handling when using
Patcherwith py.test (#135) - Fake
os.listdirreturned sorted instead of unsorted entries
Version 2.9 (2016-10-02)
io.open,os.open: support forencodingargument (#120)os.makedirs: support forexist_okargument (Python >= 3.2) (#98)- Support for fake
io.open()(#70) - Support for mount points (#25)
- Support for hard links (#75)
- Support for float times (mtime, ctime)
- Windows support:
- support for alternative path separator
- support for case-insensitive filesystems (#69)
- support for drive letters and UNC paths
- Support for filesystem size (#86)
shutil.rmtree: support forignore_errorsandonerrorarguments (#72)- Support for
os.fsync()andos.fdatasync()(#73) os.walk: Support forfollowlinksargument
shutilfunctions likemake_archivedo not work with pyfakefs (#104)- File permissions on deletion not correctly handled (#27)
shutil.copyerror with bytes contents (#105)- mtime and ctime not updated on content changes
- Moved repository from GoogleCode to GitHub, merging 3 projects
- Added continuous integration testing with Travis CI
- Added usage documentation in project wiki
- Better support for pypi releases
- Added direct unit test support in
fake_filesystem_unittest(transparently patches all calls to faked implementations) - Added support for doctests
- Added support for cygwin
- Better support for Python 3
os.utimefails to traverse symlinks (#49)chownincorrectly accepts non-integer uid/gid arguments (#30)- Reading from fake block devices doesn't work (#24)
fake_tempfileis usingAddOpenFileincorrectly (#23)- Incorrect behavior of
relpath,abspathandnormpathon Windows. - Cygwin wasn't treated as Windows (#37)
- Python 3
openin binary mode not working (#32) os.removedoesn't work with relative paths (#31)mkstempreturns no valid file descriptor (#19)openmethods lackIOErrorfor prohibited operations (#18)- Incorrectly resolved relative path (#3)
FakeFileOpenkeyword args do not match the__builtin__equivalents (#5)- Relative paths not supported (#16, #17))
There are no release notes for releases 2.6 and below. The following versions are still available on PyPI: