示例#1
0
def _flips_for_build(build: Build, next_version: Version,
                     prev_version: Version) -> List[str]:
    """
    Build a list of tasks that flipped in this build.

    :param build: Build to check.
    :param next_version: Next version to check against.
    :param prev_version: Previous version to check against.
    :return: List of tasks that flipped in given build.
    """
    next_build = next_version.build_by_variant(build.build_variant)
    prev_build = prev_version.build_by_variant(build.build_variant)

    tasks = build.get_tasks()
    next_tasks = _create_task_map(next_build.get_tasks())
    prev_tasks = _create_task_map(prev_build.get_tasks())

    return [
        task.display_name for task in tasks
        if _is_task_a_flip(task, next_tasks, prev_tasks)
    ]
 def test_get_tasks(self, sample_build):
     mock_api = MagicMock()
     build = Build(sample_build, mock_api)
     assert mock_api.tasks_by_build.return_value == build.get_tasks()