How to use the pyfakefs.fake_pathlib.FakePathlibModule function in pyfakefs

To help you get started, we’ve selected a few pyfakefs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jmcgeheeiv / pyfakefs / pyfakefs / fake_pathlib.py View on Github external
def __new__(cls, *args, **kwargs):
        """Creates the correct subclass based on OS."""
        if cls is FakePathlibModule.Path:
            cls = (FakePathlibModule.WindowsPath if os.name == 'nt'
                   else FakePathlibModule.PosixPath)
        self = cls._from_parts(args, init=True)
        return self
github jmcgeheeiv / pyfakefs / pyfakefs / fake_pathlib.py View on Github external
def init_module(filesystem):
    """Initializes the fake module with the fake file system."""
    # pylint: disable=protected-access
    FakePath.filesystem = filesystem
    FakePathlibModule.PureWindowsPath._flavour = _FakeWindowsFlavour(
        filesystem)
    FakePathlibModule.PurePosixPath._flavour = _FakePosixFlavour(filesystem)
github jmcgeheeiv / pyfakefs / pyfakefs / fake_pathlib.py View on Github external
def __new__(cls, *args, **kwargs):
        """Creates the correct subclass based on OS."""
        if cls is FakePathlibModule.Path:
            cls = (FakePathlibModule.WindowsPath if os.name == 'nt'
                   else FakePathlibModule.PosixPath)
        self = cls._from_parts(args, init=True)
        return self
github jmcgeheeiv / pyfakefs / pyfakefs / fake_pathlib.py View on Github external
def __init__(self, filesystem):
        if self.fake_pathlib is None:
            self.__class__.fake_pathlib = FakePathlibModule(filesystem)
github jmcgeheeiv / pyfakefs / pyfakefs / fake_pathlib.py View on Github external
def __new__(cls, *args, **kwargs):
        """Creates the correct subclass based on OS."""
        if cls is FakePathlibModule.Path:
            cls = (FakePathlibModule.WindowsPath if os.name == 'nt'
                   else FakePathlibModule.PosixPath)
        self = cls._from_parts(args, init=True)
        return self
github jmcgeheeiv / pyfakefs / pyfakefs / fake_pathlib.py View on Github external
def init_module(filesystem):
    """Initializes the fake module with the fake file system."""
    # pylint: disable=protected-access
    FakePath.filesystem = filesystem
    FakePathlibModule.PureWindowsPath._flavour = _FakeWindowsFlavour(
        filesystem)
    FakePathlibModule.PurePosixPath._flavour = _FakePosixFlavour(filesystem)