Skip to content

Commit 20a08c8

Browse files
authored
Added custom test marks example to Python autotest seed files (#7597)
1 parent 5752325 commit 20a08c8

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

Changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
- Refactored the method of loading `javascripts/Results/keybinding.js` in `submission_selector.jsx` (#7566)
3232
- Updated the instructor table to use `@tanstack/react-table` v8 (#7589)
3333
- Refactor `DropDownMenu` class to a new React component (#7592)
34+
- Updated Python autotest script file to include example of using `pytest.mark` to customize test marks (#7597)
3435

3536
## [v2.7.1]
3637

db/data/autotest_files/py/script_files/test2.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,15 @@ def test_with_markers(request):
5151
request.node.add_marker(pytest.mark.markus_overall_comments(
5252
"Here is some general feedback for this submission."
5353
))
54+
55+
56+
def test_with_partial_credit(request):
57+
"""This test gives the student a score of 1/2."""
58+
request.node.add_marker(pytest.mark.markus_marks_earned(0))
59+
request.node.add_marker(pytest.mark.markus_marks_total(2))
60+
61+
62+
def test_with_bonus(request):
63+
"""This test gives the student a score of 3/2."""
64+
request.node.add_marker(pytest.mark.markus_marks_earned(3))
65+
request.node.add_marker(pytest.mark.markus_marks_total(2))

0 commit comments

Comments
 (0)