def test_on_nonexistent_path_passes_silently(self): # remove_tree simply does nothing when called on a non-existent path. directory = tempfile.mkdtemp() nonexistent_tree = os.path.join(directory, 'foo') remove_tree(nonexistent_tree) self.assertFalse(os.path.isdir(nonexistent_tree)) self.assertFalse(os.path.exists(nonexistent_tree))
def setUpRoot(self): """Create `TacTestSetup.root` for storing the log and pid files. Remove the directory and create a new one if it exists. """ remove_tree(self.root) os.makedirs(self.root) if self.logfilecontent is not None: open(self.logfile, "w").write(self.logfilecontent)
def test_removes_directory(self): # remove_tree deletes the directory. directory = tempfile.mkdtemp() remove_tree(directory) self.assertFalse(os.path.isdir(directory)) self.assertFalse(os.path.exists(directory))