예제 #1
0
 def test_multiple_files(self):
     # Test mutliple files transfer
     rsync.main(['test_source/file0.txt', 'test_source/file1.txt', 'test_dest/'])
     path0 = pl.Path("test_dest/file0.txt")
     path1 = pl.Path("test_dest/file1.txt")
     self.assertIsFile(path0)
     self.assertIsFile(path1)
예제 #2
0
 def test_single_file(self):
     # Testing single file transfer
     print("this test")
     rsync.main(['test_source/file0.txt', 'test_dest/'])
     path = pl.Path("test_dest/file0.txt")
     print("end of test")
     print()
     self.assertIsFile(path)
def sync_dir(src, dist):
    lib_path = os.path.abspath('rsync.py')
    sys.path.append(lib_path)
    import rsync
    args = [
        '-ru',
        '--delete_excluded',
        src,
        dist,
    ]
    rsync.main(args)
예제 #4
0
 def test_multiple_files_with_extension(self):
     # Test mutliple files transfer with wildcard
     # Note: glob is resolved in Bash not Python, so passing the string literal 'test_source/*' as
     # a test case will fail
     inputs = ['-d']
     inputs += glob.glob('test_source/*.txt')
     inputs.append('test_dest/')
     rsync.main(inputs)
     path0 = pl.Path("test_dest/file0.txt")
     path1 = pl.Path("test_dest/file1.txt")
     path2 = pl.Path("test_dest/file2.txt")
     path3 = pl.Path("test_dest/file3.png")
     path4 = pl.Path("test_dest/file4.png")
     path5 = pl.Path("test_dest/testdir0/")
     path6 = pl.Path("test_dest/testdir1/")
     self.assertIsFile(path0)
     self.assertIsFile(path1)
     self.assertIsFile(path2)
     self.assertIsNotFile(path3)
     self.assertIsNotFile(path4)
     self.assertIsNotDir(path5)
     self.assertIsNotDir(path6)
예제 #5
0
 def test_non_exist_file(self):
     # Testing single non-existent file
     rsync.main(['test_source/file10.txt', 'test_dest/'])
     path = pl.Path("test_dest/file10.txt")
     self.assertIsNotFile(path)
예제 #6
0
 def test_single_dir_no_flag(self):
     # Testing single file transfer without option
     rsync.main(['test_source/testdir0/', 'test_dest/testdir0/'])
     path = pl.Path("test_dest/testdir0/")
     self.assertIsNotDir(path)
예제 #7
0
 def test_single_dir(self):
     # Testing single directory transfer with option
     rsync.main(['-d', 'test_source/testdir0/', 'test_dest/testdir0/'])
     path = pl.Path("test_dest/testdir0/")
     self.assertIsDir(path)
예제 #8
0
 def test_directory_to_file(self):
     # Test transferring an existent directory to a file - fails
     rsync.main(['test_source/testdir10/', 'test_dest/file0.txt'])
     path = pl.Path("test_dest/file0.txt")
     self.assertIsNotDir(path) 
     self.assertIsNotFile(path)
예제 #9
0
 def test_non_exist_dir(self):
     # Testing single non-existent directory
     rsync.main(['test_source/testdir10', 'test_dest/'])
     path = pl.Path("test_dest/testdir10/")
     self.assertIsNotDir(path)
예제 #10
0
파일: main.py 프로젝트: zelad/leLabo
'''
Created on 22 juin 2016

@author: rbeck
'''
import rsync
# rsync.main("-r dirTest backUpDirTest")
rsync.main(["-r","dirTest","backUpDirTest"])
print "ok!"