def test_run_task__revert_path_not_found(self): project_config = BaseProjectConfig(BaseGlobalConfig()) task_config = TaskConfig( {"options": { "path": "bogus", "revert_path": "bogus" }}) task = RevertManagedSrc(project_config, task_config) with self.assertRaises(TaskOptionsError): task()
def test_run_task(self): with temporary_dir() as revert_path: with open(os.path.join(revert_path, "file"), "w") as f: pass path = os.path.join(os.path.dirname(revert_path), os.path.basename(revert_path) + "_orig") project_config = BaseProjectConfig(BaseGlobalConfig()) task_config = TaskConfig( {"options": { "path": path, "revert_path": revert_path }}) task = RevertManagedSrc(project_config, task_config) task() self.assertTrue(os.path.exists(os.path.join(path, "file")))