X7ROOT File Manager
Current Path:
/opt/cloudlinux/venv/lib/python3.11/site-packages/pyfakefs
opt
/
cloudlinux
/
venv
/
lib
/
python3.11
/
site-packages
/
pyfakefs
/
ðŸ“
..
📄
__init__.py
(56 B)
ðŸ“
__pycache__
📄
_version.py
(22 B)
📄
extra_packages.py
(1.12 KB)
📄
fake_file.py
(44.85 KB)
📄
fake_filesystem.py
(113.95 KB)
📄
fake_filesystem_shutil.py
(3.67 KB)
📄
fake_filesystem_unittest.py
(41.69 KB)
📄
fake_io.py
(5.95 KB)
📄
fake_open.py
(13.07 KB)
📄
fake_os.py
(49.61 KB)
📄
fake_path.py
(17.49 KB)
📄
fake_pathlib.py
(34.06 KB)
📄
fake_scandir.py
(11.06 KB)
📄
helpers.py
(12.87 KB)
📄
mox3_stubout.py
(5.78 KB)
📄
patched_packages.py
(4.3 KB)
📄
py.typed
(68 B)
📄
pytest_plugin.py
(1.7 KB)
ðŸ“
pytest_tests
ðŸ“
tests
Editing: pytest_plugin.py
"""A pytest plugin for using pyfakefs as a fixture When pyfakefs is installed, the "fs" fixture becomes available. :Usage: def my_fakefs_test(fs): fs.create_file('/var/data/xx1.txt') assert os.path.exists('/var/data/xx1.txt') """ import py import pytest from _pytest import capture from pyfakefs.fake_filesystem_unittest import Patcher try: from _pytest import pathlib except ImportError: pathlib = None Patcher.SKIPMODULES.add(py) Patcher.SKIPMODULES.add(pytest) Patcher.SKIPMODULES.add(capture) if pathlib is not None: Patcher.SKIPMODULES.add(pathlib) @pytest.fixture def fs(request): """Fake filesystem.""" if hasattr(request, "param"): # pass optional parameters via @pytest.mark.parametrize patcher = Patcher(*request.param) else: patcher = Patcher() patcher.setUp() yield patcher.fs patcher.tearDown() @pytest.fixture(scope="class") def fs_class(request): """Class-scoped fake filesystem fixture.""" if hasattr(request, "param"): patcher = Patcher(*request.param) else: patcher = Patcher() patcher.setUp() yield patcher.fs patcher.tearDown() @pytest.fixture(scope="module") def fs_module(request): """Module-scoped fake filesystem fixture.""" if hasattr(request, "param"): patcher = Patcher(*request.param) else: patcher = Patcher() patcher.setUp() yield patcher.fs patcher.tearDown() @pytest.fixture(scope="session") def fs_session(request): """Session-scoped fake filesystem fixture.""" if hasattr(request, "param"): patcher = Patcher(*request.param) else: patcher = Patcher() patcher.setUp() yield patcher.fs patcher.tearDown()
Upload File
Create Folder