Exemplo n.º 1
0
def handle_coverage_file(extra_args):
    """Copy the coverage file back and forth."""
    # copy the previous .coverage file into the workdir
    run_in_docker("cp {}/.coverage .".format(COVERAGE_VOLUME_DST),
                  extra_args=extra_args)
    yield
    # copy the appended .coverage file into the coverage volume
    run_in_docker("cp .coverage {}".format(COVERAGE_VOLUME_DST),
                  extra_args=extra_args)
Exemplo n.º 2
0
def generate_coverage_report(coverage_volume):
    """Generate a coverage report after all tests have run."""
    yield
    # xml report for Codecov
    run_in_docker(
        "cd {} && coverage xml".format(COVERAGE_VOLUME_DST),
        extra_args=[coverage_volume],
    )
    # txt report for manual inspection
    run_in_docker(
        "cd {} && coverage report > report.txt".format(COVERAGE_VOLUME_DST),
        extra_args=[coverage_volume],
    )
Exemplo n.º 3
0
def with_reviews(with_student_repos):
    assignment_name = assignment_names[1]
    expected_review_teams = [
        plug.StudentTeam(
            members=[],
            name=plug.generate_review_team_name(
                student_team_name, assignment_name
            ),
        )
        for student_team_name in STUDENT_TEAM_NAMES
    ]
    command = " ".join(
        [
            REPOBEE_GITLAB,
            *str(repobee_plug.cli.CoreCommand.reviews.assign).split(),
            *BASE_ARGS,
            "-a",
            assignment_name,
            *STUDENTS_ARG,
            "-n",
            "1",
        ]
    )

    result = run_in_docker(command)

    assert result.returncode == 0
    assert_on_groups(
        expected_review_teams,
        single_group_assertion=expected_num_members_group_assertion(1),
    )
    return (assignment_name, expected_review_teams)
Exemplo n.º 4
0
    def local_master_repos(self, restore, extra_args):
        """Clone the master repos to disk. The restore fixture is explicitly
        included as it must be run before this fixture.
        """
        api = api_instance(TEMPLATE_ORG_NAME)
        template_repo_urls = [
            api.insert_auth(url).replace(LOCAL_DOMAIN, BASE_DOMAIN)
            for url in api.get_repo_urls(assignment_names)
        ]
        # clone the master repos to disk first first
        git_commands = [
            "git clone {}".format(url) for url in template_repo_urls
        ]
        result = run_in_docker(" && ".join(git_commands),
                               extra_args=extra_args)

        assert result.returncode == 0
        return assignment_names
Exemplo n.º 5
0
def with_student_repos(restore):
    """Set up student repos before starting tests.

    Note that explicitly including restore here is necessary to ensure that
    it runs before this fixture.
    """
    command = " ".join([
        REPOBEE_GITLAB,
        *str(repobee_plug.cli.CoreCommand.repos.setup).split(),
        *BASE_ARGS,
        *TEMPLATE_ORG_ARG,
        *MASTER_REPOS_ARG,
        *STUDENTS_ARG,
    ])

    result = run_in_docker(command)

    # pre-test asserts
    assert result.returncode == 0
    assert_repos_exist(STUDENT_TEAMS, assignment_names)
    assert_on_groups(STUDENT_TEAMS)