def remove(self, ws_name, repo_name): config = self.config if (repo_name not in config["workspaces"][ws_name]["repositories"]): raise ValueError( "%s not found in %s workspace" % (repo_name, ws_name) ) repo_path = config["workspaces"][ws_name]["repositories"][repo_name] del config["workspaces"][ws_name]["repositories"][repo_name] if (yn_choice("Do you want to delete this repository?")): shutil.rmtree(repo_path)
def rm_repo(self, wname, rname): if (rname not in self.config["workspaces"][wname]["repositories"]): raise ValueError( "%s not found in %s workspace" % (rname, wname)) repo_path = self.config["workspaces"][wname]["repositories"][rname] del self.config["workspaces"][wname]["repositories"][rname] self.config.write() if (yn_choice("Do you want to delete this repository?")): shutil.rmtree(repo_path)
def test_yn_choice(self): """Test printing input question.""" self.assertFalse(yn_choice("Test?")) self.assertTrue(yn_choice("Test?")) self.assertFalse(yn_choice("Test?"))