Beispiel #1
0
    def test_dst_has_excess_nonempty_recursive_dir(self):
        dst_dpath = self.create_dir(self.dst_dir)
        nested_dpath = self.create_dir(dst_dpath)
        self.create_file(nested_dpath)

        all(fs.rsync(self.src_dir, self.dst_dir))
        assert not os.path.lexists(dst_dpath)
Beispiel #2
0
    def test_different_types_src_dir_dst_symlink(self):
        src_dpath = self.create_dir(self.src_dir)
        dst_path = os.path.join(self.dst_dir, self.relpath(src_dpath))
        os.symlink('broken_link', dst_path)

        all(fs.rsync(self.src_dir, self.dst_dir))
        assert os.path.lexists(dst_path)
        assert os.path.isdir(dst_path)
Beispiel #3
0
    def test_different_types_src_symlink_dst_file(self):
        dst_path = self.create_file(self.dst_dir)
        src_lpath = os.path.join(self.src_dir, self.relpath(dst_path))
        os.symlink('broken_link', src_lpath)

        all(fs.rsync(self.src_dir, self.dst_dir))
        assert os.path.lexists(dst_path)
        assert os.path.islink(dst_path)
Beispiel #4
0
    def test_different_types_src_file_dst_dir(self):
        src_fpath = self.create_file(self.src_dir)
        dst_path = os.path.join(self.dst_dir, self.relpath(src_fpath))
        os.mkdir(dst_path)

        all(fs.rsync(self.src_dir, self.dst_dir))
        assert os.path.lexists(dst_path)
        assert os.path.isfile(dst_path)
Beispiel #5
0
    def test_src_dst_diff_size(self):
        src_fpath = self.create_file(self.src_dir)
        dst_fpath = os.path.join(self.dst_dir, self.relpath(src_fpath))
        with open(dst_fpath, "w") as df:
            df.write(string.printable * 2)

        all(fs.rsync(self.src_dir, self.dst_dir))
        assert os.path.lexists(dst_fpath)
        self.check_identical_file(src_fpath, dst_fpath)
Beispiel #6
0
    def test_src_is_socket(self):
        src_spath = self.create_file(self.src_dir)
        dst_spath = os.path.join(self.dst_dir, self.relpath(src_spath))
        os.unlink(src_spath)
        sock = socket.socket(socket.AF_UNIX)
        sock.bind(src_spath)

        all(fs.rsync(self.src_dir, self.dst_dir))
        assert not os.path.lexists(dst_spath)
Beispiel #7
0
    def test_different_types_src_dir_dst_file(self):
        src_dpath = self.create_dir(self.src_dir)
        dst_path = os.path.join(self.dst_dir, self.relpath(src_dpath))
        with open(dst_path, "w") as f:
            f.write(string.printable)

        all(fs.rsync(self.src_dir, self.dst_dir))
        assert os.path.lexists(dst_path)
        assert os.path.isdir(dst_path)
Beispiel #8
0
    def test_src_dst_same_inode(self):
        src_fpath = self.create_file(self.src_dir)
        dst_fpath = os.path.join(self.dst_dir, self.relpath(src_fpath))
        os.link(src_fpath, dst_fpath)

        all(fs.rsync(self.src_dir, self.dst_dir))
        assert os.path.lexists(dst_fpath)
        src_stat = os.lstat(src_fpath)
        dst_stat = os.lstat(dst_fpath)
        assert src_stat.st_nlink == 1
        assert dst_stat.st_nlink == 1
        assert src_stat.st_ino != dst_stat.st_ino
Beispiel #9
0
    def test_dst_has_excess_empty_dir(self):
        dst_dpath = self.create_dir(self.dst_dir)

        all(fs.rsync(self.src_dir, self.dst_dir))
        assert not os.path.lexists(dst_dpath)
Beispiel #10
0
    def test_dst_has_excess_symlink(self):
        dst_lpath = os.path.join(self.dst_dir, 'nonexisting_file')
        os.symlink('broken_symlink', dst_lpath)

        all(fs.rsync(self.src_dir, self.dst_dir))
        assert not os.path.lexists(dst_lpath)