def test_task_groups(self): c = Configuration() c.task_group("tg 0") c.task_group("tg 1") tg2 = c.task_group("tg 2") tg2.max_hosts(5) assert 5 == c.task_group("tg 2").to_map()["max_hosts"] assert 3 == len(c.to_map()["task_groups"])
def gen_lint_config(): targets = ["src", "test"] max_hosts = 5 variant_name = "lint variant" task_group_name = "lint group" config = Configuration() tasks = [] for t in targets: name = "make-lint-" + t config.task(name).function_with_vars("run-make", {"target": name}) tasks.append(name) group = config.task_group(task_group_name).max_hosts(max_hosts) group.setup_group().type("system").command("git.get_project").param( "directory", "src") group.setup_group().function("set-up-credentials") group.teardown_group().function("attach-test-results") group.teardown_group().function("remove-test-results") group.tasks(tasks) config.variant(variant_name).task(TaskSpec(task_group_name)) return config
def test_task_group_throws_exception_for_invalid_value(self): c = Configuration() with pytest.raises(TypeError): c.task_group(42)