Ejemplo n.º 1
0
def check_assignment(assignment: Assignment,
                     baseline: Assignment) -> Tuple[int, List[str]]:
    def check(a: Assignment):
        return list(map(execute_with_output, a.create_checks()))

    def change_result_to_mandatory(r: CheckResult):
        return CheckResult(r.result, r.msg, r.output, r.warning,
                           r.should_succeed, r.command, True)

    if assignment != baseline:
        baseline_results = list(
            map(change_result_to_mandatory, check(baseline)))
    else:
        baseline_results = []

    set_assignment_name(assignment.category)

    print_message('executing test \'{}\''.format(assignment.name))

    results = baseline_results + check(assignment)

    set_assignment_name('')

    (grade_value, reasons) = grade(results)

    for reason in reasons:
        print_warning(reason)

    print_grade(grade_value)
Ejemplo n.º 2
0
def reset_state():
    global bulk_grade_mode, bulk_grade_directory
    global file_with_commit_links

    bulk_grade_mode = False
    file_with_commit_links = None
    bulk_grade_directory = DEFAULT_BULK_GRADE_DIRECTORY
    set_assignment_name('')

    leave_quiet_mode()