Пример #1
0
def test_issue_52002_check_file_remove_symlink(test_dir):
    """
    Make sure that directories including symlinks or symlinks can be removed
    """
    # Create environment
    target = test_dir / "child 1" / "target"
    target.mkdir(parents=True)

    symlink = test_dir / "child 2" / "link"
    symlink.parent.mkdir(parents=True)
    symlink.symlink_to(target, target_is_directory=True)

    # Test removal of directory containing symlink
    win_file.remove(test_dir)
    assert test_dir.exists() is False
Пример #2
0
 def test_issue_52002_check_file_remove_symlink(self):
     """
     Make sure that directories including symlinks or symlinks can be removed
     """
     base = temp.dir(prefix="base-", parent=RUNTIME_VARS.TMP)
     target = os.path.join(base, "child 1", "target\\")
     symlink = os.path.join(base, "child 2", "link")
     try:
         # Create environment
         self.assertFalse(win_file.directory_exists(target))
         self.assertFalse(win_file.directory_exists(symlink))
         self.assertTrue(win_file.makedirs_(target))
         self.assertTrue(win_file.makedirs_(symlink))
         self.assertTrue(win_file.symlink(target, symlink))
         self.assertTrue(win_file.directory_exists(symlink))
         self.assertTrue(win_file.is_link(symlink))
         # Test removal of directory containing symlink
         self.assertTrue(win_file.remove(base))
         self.assertFalse(win_file.directory_exists(base))
     finally:
         if os.path.exists(base):
             win_file.remove(base)
Пример #3
0
 def test_issue_52002_check_file_remove_symlink(self):
     '''
     Make sure that directories including symlinks or symlinks can be removed
     '''
     base = temp.dir(prefix='base-')
     target = os.path.join(base, 'child 1', 'target\\')
     symlink = os.path.join(base, 'child 2', 'link')
     try:
         # Create environment
         self.assertFalse(win_file.directory_exists(target))
         self.assertFalse(win_file.directory_exists(symlink))
         self.assertTrue(win_file.makedirs_(target))
         self.assertTrue(win_file.makedirs_(symlink))
         self.assertTrue(win_file.symlink(target, symlink))
         self.assertTrue(win_file.directory_exists(symlink))
         self.assertTrue(win_file.is_link(symlink))
         # Test removal of directory containing symlink
         self.assertTrue(win_file.remove(base))
         self.assertFalse(win_file.directory_exists(base))
     finally:
         if os.path.exists(base):
             win_file.remove(base)
Пример #4
0
 def test_issue_52002_check_file_remove_symlink(self):
     '''
     Make sure that directories including symlinks or symlinks can be removed
     '''
     base = temp.dir(prefix='base')
     target = os.path.join(base, 'child 1', 'target/')
     symlink = os.path.join(base, 'child 2', 'link')
     self.assertFalse(win_file.directory_exists(target))
     self.assertFalse(win_file.directory_exists(symlink))
     self.assertTrue(win_file.makedirs_(target))
     self.assertTrue(win_file.directory_exists(symlink))
     self.assertTrue(win_file.symlink(target, symlink))
     self.assertTrue(win_file.is_link(symlink))
     self.assertTrue(win_file.remove(base))
     self.assertFalse(win_file.directory_exists(base))