Пример #1
0
 def test_copy_path_to_exits_path(self, tmpdir):
     d1 = str(tmpdir.join('test1'))
     d2 = str(tmpdir.join('test2'))
     makedirs(d1)
     makedirs(d2)
     with pytest.raises(Exception):
         copy(d1, d2)
Пример #2
0
 def test_copy_without_ignore_error(self, tmpdir):
     d1 = str(tmpdir.join('test1'))
     d2 = str(tmpdir.join('test2'))
     makedirs(d1)
     makedirs(d2)
     with pytest.raises(Exception):
         copy(d1, d2, ignore_errors=False)
Пример #3
0
 def test_copy_path_to_exits_path(self, tmpdir):
     d1 = str(tmpdir.join('test1'))
     d2 = str(tmpdir.join('test2'))
     makedirs(d1)
     makedirs(d2)
     with pytest.raises(Exception):
         copy(d1, d2)
Пример #4
0
 def test_copy_without_ignore_error(self, tmpdir):
     d1 = str(tmpdir.join('test1'))
     d2 = str(tmpdir.join('test2'))
     makedirs(d1)
     makedirs(d2)
     with pytest.raises(Exception):
         copy(d1, d2, ignore_errors=False)
Пример #5
0
 def test_copy_non_empty_dir(self, tmpdir):
     f = str(tmpdir.join('test/test.txt'))
     d = str(tmpdir.join('test'))
     d_copy = str(tmpdir.join('test_copy'))
     os.makedirs(d)
     touch(f)
     copy(d, d_copy)
     assert os.path.exists(d_copy)
Пример #6
0
 def test_copy_non_empty_dir(self, tmpdir):
     f = str(tmpdir.join('test/test.txt'))
     d = str(tmpdir.join('test'))
     d_copy = str(tmpdir.join('test_copy'))
     os.makedirs(d)
     touch(f)
     copy(d, d_copy)
     assert os.path.exists(d_copy)
Пример #7
0
 def test_copy_file_not_follow_symlink(self, tmpdir):
     f = str(tmpdir.join('test.txt'))
     link_f = str(tmpdir.join('test.link'))
     copy_link_f = str(tmpdir.join('test_copy.link'))
     touch(f)
     os.symlink(f, link_f)
     copy(link_f, copy_link_f, follow_symlinks=False)
     assert os.path.exists(copy_link_f)
     assert os.path.islink(copy_link_f)
Пример #8
0
 def test_copy_file_not_follow_symlink(self, tmpdir):
     f = str(tmpdir.join('test.txt'))
     link_f = str(tmpdir.join('test.link'))
     copy_link_f = str(tmpdir.join('test_copy.link'))
     touch(f)
     os.symlink(f, link_f)
     copy(link_f, copy_link_f, follow_symlinks=False)
     assert os.path.exists(copy_link_f)
     assert os.path.islink(copy_link_f)
Пример #9
0
 def test_copy_dir_not_follow_symlink(self, tmpdir):
     f = str(tmpdir.join('test/test.txt'))
     d = str(tmpdir.join('test'))
     link_f = str(tmpdir.join('test/test_link.txt'))
     d_copy = str(tmpdir.join('test_copy'))
     new_link_f = str(tmpdir.join('test_copy/test_link.txt'))
     makedirs(d)
     touch(f)
     os.symlink(f, link_f)
     copy(d, d_copy, follow_symlinks=False)
     assert os.path.exists(d_copy)
     assert not os.path.islink(new_link_f)
Пример #10
0
 def test_copy_dir_not_follow_symlink(self, tmpdir):
     f = str(tmpdir.join('test/test.txt'))
     d = str(tmpdir.join('test'))
     link_f = str(tmpdir.join('test/test_link.txt'))
     d_copy = str(tmpdir.join('test_copy'))
     new_link_f = str(tmpdir.join('test_copy/test_link.txt'))
     makedirs(d)
     touch(f)
     os.symlink(f, link_f)
     copy(d, d_copy, follow_symlinks=False)
     assert os.path.exists(d_copy)
     assert not os.path.islink(new_link_f)
Пример #11
0
 def test_copy_with_ignore_error(self, tmpdir):
     d1 = str(tmpdir.join('test1'))
     d2 = str(tmpdir.join('test2'))
     makedirs(d1)
     makedirs(d2)
     copy(d1, d2, ignore_errors=True)
Пример #12
0
 def test_copy_empty_dir(self, tmpdir):
     d = str(tmpdir.join('test'))
     d_copy = str(tmpdir.join('test_copy'))
     makedirs(d)
     copy(d, d_copy)
     assert os.path.exists(d_copy)
Пример #13
0
 def test_copy_file(self, tmpdir):
     f = str(tmpdir.join('test.txt'))
     f_copy = str(tmpdir.join('test_copy.txt'))
     touch(f)
     copy(f, f_copy)
     assert os.path.exists(f_copy)
Пример #14
0
 def test_copy_with_ignore_error(self, tmpdir):
     d1 = str(tmpdir.join('test1'))
     d2 = str(tmpdir.join('test2'))
     makedirs(d1)
     makedirs(d2)
     copy(d1, d2, ignore_errors=True)
Пример #15
0
 def test_copy_empty_dir(self, tmpdir):
     d = str(tmpdir.join('test'))
     d_copy = str(tmpdir.join('test_copy'))
     makedirs(d)
     copy(d, d_copy)
     assert os.path.exists(d_copy)
Пример #16
0
 def test_copy_file(self, tmpdir):
     f = str(tmpdir.join('test.txt'))
     f_copy = str(tmpdir.join('test_copy.txt'))
     touch(f)
     copy(f, f_copy)
     assert os.path.exists(f_copy)