SILENT KILLERPanel

Current Path: > > opt > cloudlinux > venv > lib64 > python3.11 > > > site-packages > pyfakefs > pytest_tests


Operation   : Linux premium131.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
Software     : Apache
Server IP    : 162.0.232.56 | Your IP: 216.73.216.111
Domains      : 1034 Domain(s)
Permission   : [ 0755 ]

Files and Folders in: //opt/cloudlinux/venv/lib64/python3.11///site-packages/pyfakefs/pytest_tests

NameTypeSizeLast ModifiedActions
__pycache__ Directory - -
__init__.py File 0 bytes April 17 2025 13:10:58.
conftest.py File 1333 bytes April 17 2025 13:10:58.
example.py File 652 bytes April 17 2025 13:10:58.
io.py File 346 bytes April 17 2025 13:10:58.
pytest_check_failed_plugin_test.py File 658 bytes April 17 2025 13:10:58.
pytest_doctest_test.py File 1428 bytes April 17 2025 13:10:58.
pytest_fixture_param_test.py File 1913 bytes April 17 2025 13:10:58.
pytest_fixture_test.py File 1957 bytes April 17 2025 13:10:58.
pytest_module_fixture_test.py File 894 bytes April 17 2025 13:10:58.
pytest_plugin_failing_helper.py File 129 bytes April 17 2025 13:10:58.
pytest_plugin_test.py File 2380 bytes April 17 2025 13:10:58.

Reading File: //opt/cloudlinux/venv/lib64/python3.11///site-packages/pyfakefs/pytest_tests/pytest_plugin_test.py

"""Tests that the pytest plugin properly provides the "fs" fixture"""
import os
import tempfile

from pyfakefs.fake_filesystem import OSType
from pyfakefs.fake_filesystem_unittest import Pause
import pyfakefs.pytest_tests.io


def test_fs_fixture(fs):
    fs.create_file("/var/data/xx1.txt")
    assert os.path.exists("/var/data/xx1.txt")


def test_fs_fixture_alias(fake_filesystem):
    fake_filesystem.create_file("/var/data/xx1.txt")
    assert os.path.exists("/var/data/xx1.txt")


def test_both_fixtures(fs, fake_filesystem):
    fake_filesystem.create_file("/var/data/xx1.txt")
    fs.create_file("/var/data/xx2.txt")
    assert os.path.exists("/var/data/xx1.txt")
    assert os.path.exists("/var/data/xx2.txt")
    assert fs == fake_filesystem


def test_pause_resume(fs):
    fake_temp_file = tempfile.NamedTemporaryFile()
    assert fs.exists(fake_temp_file.name)
    assert os.path.exists(fake_temp_file.name)
    fs.pause()
    assert fs.exists(fake_temp_file.name)
    assert not os.path.exists(fake_temp_file.name)
    real_temp_file = tempfile.NamedTemporaryFile()
    assert not fs.exists(real_temp_file.name)
    assert os.path.exists(real_temp_file.name)
    fs.resume()
    assert not os.path.exists(real_temp_file.name)
    assert os.path.exists(fake_temp_file.name)


def test_pause_resume_contextmanager(fs):
    fake_temp_file = tempfile.NamedTemporaryFile()
    assert fs.exists(fake_temp_file.name)
    assert os.path.exists(fake_temp_file.name)
    with Pause(fs):
        assert fs.exists(fake_temp_file.name)
        assert not os.path.exists(fake_temp_file.name)
        real_temp_file = tempfile.NamedTemporaryFile()
        assert not fs.exists(real_temp_file.name)
        assert os.path.exists(real_temp_file.name)
    assert not os.path.exists(real_temp_file.name)
    assert os.path.exists(fake_temp_file.name)


def test_use_own_io_module(fs):
    filepath = "foo.txt"
    with open(filepath, "w") as f:
        f.write("bar")

    stream = pyfakefs.pytest_tests.io.InputStream(filepath)
    assert stream.read() == "bar"


def test_switch_to_windows(fs):
    fs.os = OSType.WINDOWS
    assert os.path.exists(tempfile.gettempdir())


def test_switch_to_linux(fs):
    fs.os = OSType.LINUX
    assert os.path.exists(tempfile.gettempdir())


def test_switch_to_macos(fs):
    fs.os = OSType.MACOS
    assert os.path.exists(tempfile.gettempdir())

SILENT KILLER Tool