Ejemplo n.º 1
0
 def test_trash_outside_prefix(self):
     tmp_dir = tempfile.mkdtemp()
     rel = relpath(tmp_dir, context.root_dir)
     self.assertTrue(rel.startswith(u'..'))
     move_path_to_trash(tmp_dir)
     self.assertFalse(exists(tmp_dir))
     makedirs(tmp_dir)
     move_path_to_trash(tmp_dir)
     self.assertFalse(exists(tmp_dir))
Ejemplo n.º 2
0
 def test_trash_outside_prefix(self):
     tmp_dir = tempfile.mkdtemp()
     rel = relpath(tmp_dir, context.root_dir)
     self.assertTrue(rel.startswith(u'..'))
     move_path_to_trash(tmp_dir)
     self.assertFalse(exists(tmp_dir))
     makedirs(tmp_dir)
     move_path_to_trash(tmp_dir)
     self.assertFalse(exists(tmp_dir))
Ejemplo n.º 3
0
 def test_trash_outside_prefix(self):
     from conda.config import root_dir
     tmp_dir = tempfile.mkdtemp()
     rel = relpath(tmp_dir, root_dir)
     self.assertTrue(rel.startswith(u'..'))
     move_path_to_trash(tmp_dir)
     self.assertFalse(exists(tmp_dir))
     makedirs(tmp_dir)
     move_path_to_trash(tmp_dir)
     self.assertFalse(exists(tmp_dir))
Ejemplo n.º 4
0
 def test_trash_outside_prefix(self):
     from conda.config import root_dir
     tmp_dir = tempfile.mkdtemp()
     rel = relpath(tmp_dir, root_dir)
     self.assertTrue(rel.startswith(u'..'))
     move_path_to_trash(tmp_dir)
     self.assertFalse(exists(tmp_dir))
     makedirs(tmp_dir)
     move_path_to_trash(tmp_dir)
     self.assertFalse(exists(tmp_dir))
Ejemplo n.º 5
0
 def test_trash_long_paths(self):
     unc_prefix = '\\\\?\\' if platform == 'win32' else ''
     pkg_dir = config.pkgs_dirs[0]
     longfoldername="trash_with_a_very_very_long_and_silly_name_indeed"
     tmpdir=pkg_dir
     for i in range(6):
         tmpdir = join(tmpdir, longfoldername)
         if not i:
             toptmpdir = tmpdir
     tmpfile = join(tmpdir, self.tmpfname)
     makedirs(unc_prefix + tmpdir)
     with open(unc_prefix + tmpfile, 'w') as fo:
         fo.write('trashy')
     delete_trash(config.pkgs_dirs[0])
     move_path_to_trash(toptmpdir)
     trash = _get_trash_dir(config.pkgs_dirs[0])
     contents = [basename(dp) for dp, dn, fn in walk(trash)]
     self.assertIn(longfoldername, contents)
     delete_trash(config.pkgs_dirs[0])
     contents = [basename(dp) for dp, dn, fn in walk(trash)]
     self.assertTrue(longfoldername not in contents)
Ejemplo n.º 6
0
 def test_trash_long_paths(self):
     unc_prefix = u'\\\\?\\' if platform == 'win32' else ''
     pkg_dir = config.pkgs_dirs[0]
     longfoldername = "trash_with_a_very_very_long_and_silly_name_indeed"
     tmpdir = pkg_dir
     for i in range(6):
         tmpdir = join(tmpdir, longfoldername)
         if not i:
             toptmpdir = tmpdir
     tmpfile = join(tmpdir, self.tmpfname)
     makedirs(unc_prefix + tmpdir)
     with open(unc_prefix + tmpfile, 'w') as fo:
         fo.write('trashy')
     delete_trash(config.pkgs_dirs[0])
     delete_trash(config.pkgs_dirs[0])
     move_path_to_trash(toptmpdir)
     trash = _get_trash_dir(config.pkgs_dirs[0])
     contents = [basename(dp) for dp, dn, fn in walk(trash)]
     self.assertIn(longfoldername, contents)
     delete_trash(config.pkgs_dirs[0])
     delete_trash(config.pkgs_dirs[0])
     contents = [basename(dp) for dp, dn, fn in walk(trash)]
     self.assertTrue(longfoldername not in contents)