PHP 8.2.30
Preview: test_patch_on_setup.py Size: 949 B
/opt/cloudlinux/venv/lib64/python3.11/site-packages/pyfakefs/pytest_tests/test_patch_on_setup.py

from pathlib import Path

import pytest

from pyfakefs.fake_filesystem import FakeFilesystem


def pytest_generate_tests(metafunc):
    handlers = [a, b, c]
    if "handler_class" in metafunc.fixturenames:
        metafunc.parametrize("handler_class", handlers)


def a():
    pass


def b():
    pass


def c():
    pass


@pytest.fixture
def class_a():
    pass


@pytest.fixture
def class_b():
    pass


@pytest.fixture
def class_c():
    pass


@pytest.fixture
def make_handler(request):
    def _make_handler(cls):
        return request.getfixturevalue(f"class_{cls.__name__}")

    yield _make_handler


@pytest.fixture
def handler_and_check(handler_class, make_handler):
    assert Path("/foo/bar").exists()
    yield


def test_handler_and_check_in_fixture(handler_and_check):
    assert Path("/foo/bar").exists()


@pytest.fixture(scope="module", autouse=True)
def config(fs_module: FakeFilesystem):
    fs_module.create_file("/foo/bar")

Directory Contents

Dirs: 4 × Files: 19

Name Size Perms Modified Actions
data DIR
- drwxr-xr-x 2026-02-06 08:01:08
Edit Download
hook_test DIR
- drwxr-xr-x 2026-02-06 08:01:08
Edit Download
- drwxr-xr-x 2026-02-06 08:01:05
Edit Download
- drwxr-xr-x 2026-02-06 08:01:08
Edit Download
1.30 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
652 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
855 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
341 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
75 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
132 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
659 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
1.36 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
1.85 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
2.48 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
1.02 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
128 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
2.50 KB lrw-r--r-- 2026-01-20 13:01:47
Edit Download
828 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
348 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
949 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
771 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
390 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download
0 B lrw-r--r-- 2026-01-20 13:01:47
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).