OXIESEC PANEL
- Current Dir:
/
/
opt
/
cloudlinux
/
venv
/
lib
/
python3.11
/
site-packages
/
pyfakefs
Server IP: 2a02:4780:11:1084:0:327f:3464:10
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
09/05/2025 09:34:06 AM
rwxr-xr-x
📄
__init__.py
56 bytes
12/18/2024 10:23:15 AM
rw-r--r--
📁
__pycache__
-
02/07/2025 10:01:34 PM
rwxr-xr-x
📄
_version.py
22 bytes
12/18/2024 10:23:15 AM
rw-r--r--
📄
extra_packages.py
1.12 KB
12/18/2024 10:23:15 AM
rw-r--r--
📄
fake_file.py
44.85 KB
12/18/2024 10:23:15 AM
rw-r--r--
📄
fake_filesystem.py
113.95 KB
12/18/2024 10:23:15 AM
rw-r--r--
📄
fake_filesystem_shutil.py
3.67 KB
12/18/2024 10:23:15 AM
rw-r--r--
📄
fake_filesystem_unittest.py
41.69 KB
12/18/2024 10:23:15 AM
rw-r--r--
📄
fake_io.py
5.95 KB
12/18/2024 10:23:15 AM
rw-r--r--
📄
fake_open.py
13.07 KB
12/18/2024 10:23:15 AM
rw-r--r--
📄
fake_os.py
49.61 KB
12/18/2024 10:23:15 AM
rw-r--r--
📄
fake_path.py
17.49 KB
12/18/2024 10:23:15 AM
rw-r--r--
📄
fake_pathlib.py
34.06 KB
12/18/2024 10:23:15 AM
rw-r--r--
📄
fake_scandir.py
11.06 KB
12/18/2024 10:23:15 AM
rw-r--r--
📄
helpers.py
12.87 KB
12/18/2024 10:23:15 AM
rw-r--r--
📄
mox3_stubout.py
5.78 KB
12/18/2024 10:23:15 AM
rw-r--r--
📄
patched_packages.py
4.3 KB
12/18/2024 10:23:15 AM
rw-r--r--
📄
py.typed
68 bytes
12/18/2024 10:23:15 AM
rw-r--r--
📄
pytest_plugin.py
1.7 KB
12/18/2024 10:23:15 AM
rw-r--r--
📁
pytest_tests
-
02/07/2025 10:01:35 PM
rwxr-xr-x
📁
tests
-
02/07/2025 10:01:35 PM
rwxr-xr-x
Editing: pytest_plugin.py
Close
"""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()