async def async_main(config, task): """Run all the vcs things. Args: config (dict): the running config. task (dict): the running task. """ work_dir = config["work_dir"] repo_path = os.path.join(work_dir, "src") actions_to_perform = task_action_types(config, task) await log_mercurial_version(config) if not await validate_robustcheckout_works(config): raise TreeScriptError("Robustcheckout can't run on our version of hg, aborting") await retry_async(do_actions, args=(config, task, actions_to_perform, repo_path), retry_exceptions=(CheckoutError, PushError)) log.info("Done!")
def test_task_action_types_missing_action(scopes): task = {"scopes": scopes} with pytest.raises(TaskVerificationError): ttask.task_action_types(SCRIPT_CONFIG, task)
def test_task_action_types_valid_scopes(actions, scopes): task = {"scopes": scopes} assert actions == ttask.task_action_types(SCRIPT_CONFIG, task)
def test_task_action_types_actions(actions): task = {"payload": {"actions": actions}} assert actions == ttask.task_action_types(SCRIPT_CONFIG, task)
def test_should_push_false(task): actions = ttask.task_action_types(SCRIPT_CONFIG, task) assert False is ttask.should_push(task, actions)
def test_task_action_types_actions_invalid(actions): task = {"payload": {"actions": actions}} with pytest.raises(TaskVerificationError): ttask.task_action_types(SCRIPT_CONFIG, task)