Skip to content

Commit

Permalink
Fix status for partial scores
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacl committed Sep 18, 2022
1 parent c825062 commit 16a4ad0
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion gradescope_utils/autograder_utils/json_test_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def getOutput(self):
return out

def buildResult(self, test, err=None):
failed = err is not None
weight = self.getWeight(test)
tags = self.getTags(test)
number = self.getNumber(test)
Expand All @@ -79,7 +80,6 @@ def buildResult(self, test, err=None):
output += err[1] + '\n' if err[1] else 'Test Failed\n'
result = {
"name": self.getDescription(test),
"status": "failed" if err else "passed",
}
if score is not None or weight is not None:
if weight is None:
Expand All @@ -88,6 +88,11 @@ def buildResult(self, test, err=None):
score = 0.0 if err else weight
result["score"] = score
result["max_score"] = weight
# Also mark failure if points are lost
failed |= score < weight

result["status"] = "failed" if failed else "passed"

if tags:
result["tags"] = tags
if output:
Expand Down

0 comments on commit 16a4ad0

Please sign in to comment.