Skip to content

Commit 7ae956c

Browse files
committed
Fail the test when partial credit is set to 0 (fixes #19)
1 parent 90e4a83 commit 7ae956c

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313
- `get_source_tree` function in audit.py
1414
- `name_date` function in common.py
1515

16+
### Fixed
17+
18+
- fail test if partial credit is set to 0 (#19)
19+
1620
### Changed
1721

1822
- ignore other files if ADDITIONAL_FILES is None

jmu_pytest_utils/plugin.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,16 +105,16 @@ def pytest_sessionfinish(session: pytest.Session, exitstatus: int) -> None:
105105
# max_score is set by the @weight() decorator
106106
weight = getattr(test_function, "weight", 0)
107107
# score can be set manually for partial credit
108-
score = getattr(test_function, "score", 0)
109-
if not score:
108+
score = getattr(test_function, "score", None)
109+
if score is None:
110110
# The default score is all or nothing
111111
if any(r.failed for r in reports):
112112
score = 0
113113
else:
114114
score = weight
115115
# Show score only if not 0/0 points (blue)
116116
if score or weight:
117-
total_score += score
117+
total_score = score
118118
test["score"] = score
119119
test["max_score"] = weight
120120

0 commit comments

Comments
 (0)