Esempio n. 1
0
def invoke_commits_check(student_repository, expected_count, exact=False):
    """Check to see if the repository has more than specified commits"""
    # inspect the Git repository internals for the commits
    did_check_pass, actual_count = repository.commits_greater_than_count(
        student_repository, expected_count, exact)
    # create the message and the diagnostic
    if not exact:
        message = "Repository has at least " + str(
            expected_count) + " commit(s)"
    else:
        message = "Repository has exactly " + str(
            expected_count) + " commit(s)"
    diagnostic = "Found " + str(
        actual_count) + " commit(s) in the Git repository"
    update_report(did_check_pass, message, diagnostic)
    return did_check_pass
Esempio n. 2
0
def invoke_commits_check(student_repository, expected_count, exact=False):
    """Check to see if the repository has more than specified commits."""
    # inspect the Git repository internals for the commits
    did_check_pass, actual_count = repository.commits_greater_than_count(
        student_repository, expected_count, exact
    )
    # create the message and the diagnostic
    if not exact:
        # create a message for an "at least" because it is not exact
        # the "at least" check is the default, you must opt-in to an exact check
        message = "The repository has at least " + str(expected_count) + " commit(s)"
    else:
        # create a message for an exact check
        message = "The repository has exactly " + str(expected_count) + " commit(s)"
    # diagnostic is created when repository does not have sufficient commits
    # call report_result to update report for this check
    diagnostic = "Found " + str(actual_count) + " commit(s) in the Git repository"
    report_result(did_check_pass, message, diagnostic)
    return did_check_pass
Esempio n. 3
0
def test_repository_commits_not_huge_exacted():
    """Checks to ensure that commit counts work correctly"""
    valid, __ = repository.commits_greater_than_count(".", sys.maxsize, True)
    assert valid is False
Esempio n. 4
0
def test_repository_not_zero_commits_greater_than():
    """Checks to ensure that commit counts work correctly"""
    valid, __ = repository.commits_greater_than_count(".", 1)
    assert valid is True
def test_repository_not_zero_commits_greater_than_exacted():
    """Check to ensure that commit counts work correctly."""
    valid, __ = repository.commits_greater_than_count(".", 1, True)
    assert valid is False