jmu_gradescope_utils.coverage_utils
Utilities for running student tests and checking code coverage.
- jmu_gradescope_utils.coverage_utils.check_coverage(checked_files, branch=False, target_percentage=100.0, print_feedback=True, show_details=True, success_required=True)
Check code coverage for student-submitted unit tests.
- Parameters
checked_files (list) – A list of file names for the files that should be covered by the tests.
target_percentage (float) – The target coverage percentage for each file.
branch (bool) – True if branch coverage should be checked, False for statement coverage only.
print_feedback (bool) – True if success or failure message should be printed.
show_details (bool) – True if a detailed coverage report should be printed in the case that coverage is less than target.
success_required – True if an AssertionError should be raised in the case of insufficient coverage.
- Returns
True if coverage hits target, False otherwise.
- Return type
bool
- Raises
AssertionError if success_required, and coverage is below target. –
- jmu_gradescope_utils.coverage_utils.get_gradescope_base()
- jmu_gradescope_utils.coverage_utils.run_student_tests(print_feedback=True, show_traces=True, success_required=True)
Run a suite of student submitted tests.
Tests must be located in /autograder/source/student_tests/
- Parameters
print_feedback (bool) – Print success or failure message
show_traces (bool) – Show failure/error stack traces
success_required (bool) – If True, this function will raise an AssertionError if any student tests fail.
- Returns
True if all tests pass, False otherwise
- Return type
bool
- Raises
AssertionError if success_required is true and any test fails. –