Пример #1
0
 def test_do_clobber(self):
     file_name = 'my-name-is-mud'
     inner_dir = tempfile.mkdtemp(dir=self.outer_dir)
     open(os.path.join(self.outer_dir, file_name), 'a').close()
     self.assertTrue(os.path.exists(self.outer_dir))
     self.assertTrue(os.path.exists(inner_dir))
     self.assertTrue(os.path.exists(file_name))
     do_clobber(self.outer_dir)
     self.assertFalse(os.path.exists(inner_dir))
     self.assertFalse(os.path.exists(file_name))
     self.assertTrue(os.path.exists(self.outer_dir))
Пример #2
0
 def test_do_clobber_with_skip(self):
     skip_dir_name = 'muddy-mud-skipper'
     skip_file_name = 'powdered-toast'
     inner_dir = tempfile.mkdtemp(dir=self.outer_dir)
     open(os.path.join(self.outer_dir, skip_file_name), 'a').close()
     os.mkdir(os.path.join(self.outer_dir, skip_dir_name))
     self.assertTrue(os.path.exists(inner_dir))
     self.assertTrue(os.path.exists(skip_dir_name))
     self.assertTrue(os.path.exists(skip_file_name))
     do_clobber(self.outer_dir, skip=[skip_dir_name, skip_file_name])
     self.assertFalse(os.path.exists(inner_dir))
     self.assertTrue(os.path.exists(skip_dir_name))
     self.assertTrue(os.path.exists(skip_file_name))
     os.rmdir(skip_dir_name)
     os.remove(skip_file_name)