How to use the pyfakefs.fake_filesystem.FakeFilesystem.rename 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
        lambda fs, old_path, new_path: FakeFilesystem.rename(
            fs, old_path, new_path, force_replace=True))
github kobayashi / s3monkey / s3monkey / pyfakefs / fake_pathlib.py View on Github external
if hasattr(os, "lchmod"):
        lchmod = _wrap_strfunc(lambda fs, path, mode: FakeFilesystem.chmod(
            fs, path, mode, follow_symlinks=False))
    else:
        def lchmod(self, pathobj, mode):
            """Raises not implemented for Windows systems."""
            raise NotImplementedError("lchmod() not available on this system")

    mkdir = _wrap_strfunc(FakeFilesystem.makedir)

    unlink = _wrap_strfunc(FakeFilesystem.remove)

    rmdir = _wrap_strfunc(FakeFilesystem.rmdir)

    rename = _wrap_binary_strfunc(FakeFilesystem.rename)

    replace = _wrap_binary_strfunc(lambda fs, old_path, new_path:
                                   FakeFilesystem.rename(
                                       fs, old_path, new_path, force_replace=True))

    symlink = _wrap_binary_strfunc_reverse(
        lambda fs, file_path, link_target, target_is_directory:
        FakeFilesystem.create_symlink(fs, file_path, link_target,
                                      create_missing_dirs=False))

    utime = _wrap_strfunc(FakeFilesystem.utime)

_fake_accessor = _FakeAccessor()


class _FakeFlavour(pathlib._Flavour):
github kobayashi / s3monkey / s3monkey / pyfakefs / fake_pathlib.py View on Github external
replace = _wrap_binary_strfunc(lambda fs, old_path, new_path:
                                   FakeFilesystem.rename(
                                       fs, old_path, new_path, force_replace=True))
github jmcgeheeiv / pyfakefs / pyfakefs / fake_pathlib.py View on Github external
if hasattr(os, "lchmod"):
        lchmod = _wrap_strfunc(lambda fs, path, mode: FakeFilesystem.chmod(
            fs, path, mode, follow_symlinks=False))
    else:
        def lchmod(self, pathobj, mode):
            """Raises not implemented for Windows systems."""
            raise NotImplementedError("lchmod() not available on this system")

    mkdir = _wrap_strfunc(FakeFilesystem.makedir)

    unlink = _wrap_strfunc(FakeFilesystem.remove)

    rmdir = _wrap_strfunc(FakeFilesystem.rmdir)

    rename = _wrap_binary_strfunc(FakeFilesystem.rename)

    replace = _wrap_binary_strfunc(
        lambda fs, old_path, new_path: FakeFilesystem.rename(
            fs, old_path, new_path, force_replace=True))

    symlink = _wrap_binary_strfunc_reverse(
        lambda fs, file_path, link_target, target_is_directory:
        FakeFilesystem.create_symlink(fs, file_path, link_target,
                                      create_missing_dirs=False))

    utime = _wrap_strfunc(FakeFilesystem.utime)


_fake_accessor = _FakeAccessor()

flavour = pathlib._Flavour if pathlib else object