1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
|
Metadata-Version: 2.4
Name: pyfakefs
Version: 6.0.0
Summary: Implements a fake file system that mocks the Python file system modules.
Author-email: Google <google-pyfakefs@google.com>, John McGehee <pyfakefs@johnnado.com>
Maintainer-email: mrbean-bremen <hansemrbean@googlemail.com>
License-Expression: Apache-2.0
Project-URL: documentation, https://pytest-pyfakefs.readthedocs.io/
Project-URL: homepage, https://github.com/pytest-dev/pyfakefs
Project-URL: repository, https://github.com/pytest-dev/pyfakefs
Project-URL: changelog, https://github.com/pytest-dev/pyfakefs/blob/main/CHANGES.md
Keywords: testing,filesystem,mocking,unittest,pytest
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Operating System :: POSIX
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Testing
Classifier: Topic :: System :: Filesystems
Classifier: Framework :: Pytest
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: COPYING
Dynamic: license-file
# pyfakefs [](https://badge.fury.io/py/pyfakefs) [](https://img.shields.io/pypi/pyversions/pyfakefs.svg)  [](https://pytest-pyfakefs.readthedocs.io/en/latest/?badge=latest) [](https://results.pre-commit.ci/latest/github/pytest-dev/pyfakefs/main) 
`pyfakefs` implements a fake file system that mocks the Python file system modules.
Using `pyfakefs`, your tests operate on a fake file system in memory without
touching the real disk. The software under test requires no modification to
work with `pyfakefs`.
`pyfakefs` creates a new empty in-memory file system at each test start, which replaces
the real filesystem during the test. Think of pyfakefs as making a per-test temporary
directory, except for an entire file system.
`pyfakefs` is tested with current versions of Linux, Windows and macOS.
## Usage
There are several ways to invoke `pyfakefs`:
* using the `fs` fixture with `pytest`
* deriving from `fake_filesystem_unittest.TestCase` for `unittest`
* using `fake_filesystem_unittest.Patcher` as context manager
* using the `fake_filesystem_unittest.patchfs` decorator on a single test
Refer to the [usage documentation](https://pytest-pyfakefs.readthedocs.io/en/latest/usage.html) for more information.
## Documentation
* [Release documentation](https://pytest-pyfakefs.readthedocs.io/en/stable)
covers the latest released version
* [Development documentation](https://pytest-pyfakefs.readthedocs.io/en/latest)
for the current main branch
* [Release 3.7 documentation](https://pytest-pyfakefs.readthedocs.io/en/v3.7.2/)
for the last version supporting Python 2.7
* [Release Notes](https://github.com/pytest-dev/pyfakefs/blob/main/CHANGES.md)
* [Contributing Guide](https://github.com/pytest-dev/pyfakefs/blob/main/CONTRIBUTING.md) - contributions are welcome!
## Features
Apart from automatically mocking most file-system functions, pyfakefs
provides some additional features:
- mapping files and directories from the real file system into the fake filesystem
- configuration and tracking of the file system size
- pause and resume of patching to be able to use the real file system inside a
test step
- (limited) emulation of other OSes (Linux, macOS or Windows)
- configuration to behave as if running as a non-root user while running
under root
## Limitations
pyfakefs will not work with Python libraries that use C libraries to access the
file system. This is because pyfakefs cannot patch the underlying C libraries'
file access functions--the C libraries will always access the real file
system. Refer to the [documentation](https://pytest-pyfakefs.readthedocs.io/en/latest/intro.html#limitations)
for more information about the limitations of pyfakefs.
## History
pyfakefs.py was initially developed at Google by Mike Bland as a modest fake
implementation of core Python modules. It was introduced to all of Google
in September 2006. At last count, pyfakefs was used in over 20,000
Python tests at Google.
Google released pyfakefs to the public in 2011 as a Google Code project.
Support for `unittest` and `doctest` was added in a fork by user `jmcgeheeiv`,
further corrections were made in a separate fork with user `shiffdane`, and after
the [shutdown of Google Code](http://google-opensource.blogspot.com/2015/03/farewell-to-google-code.html)
was announced, [John McGehee](https://github.com/jmcgeheeiv) merged all three Google Code projects together
[here on GitHub](https://github.com/pytest-dev/pyfakefs). In 2022, the repository has been transferred to
[pytest-dev](https://github.com/pytest-dev) to ensure continuous maintenance.
|