aboutsummaryrefslogtreecommitdiffstats
path: root/backend/routes/forms/submit.py
diff options
context:
space:
mode:
authorGravatar Hassan Abouelela <[email protected]>2021-06-02 04:17:52 +0300
committerGravatar Hassan Abouelela <[email protected]>2021-06-02 04:17:52 +0300
commit0ab266861a34feb576ff8872123b97a366d8359d (patch)
treed887011d1eca8519e209ac5d41815e4d6a7d9fb3 /backend/routes/forms/submit.py
parentRecords Failed Unittests (diff)
Reports All Unittest Failure Reasons
Records the reason of failure for non-zero exit codes. Signed-off-by: Hassan Abouelela <[email protected]>
Diffstat (limited to 'backend/routes/forms/submit.py')
-rw-r--r--backend/routes/forms/submit.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/backend/routes/forms/submit.py b/backend/routes/forms/submit.py
index 97cf2ac..fe2abd5 100644
--- a/backend/routes/forms/submit.py
+++ b/backend/routes/forms/submit.py
@@ -178,8 +178,15 @@ class SubmitForm(Route):
}
if test.return_code == 0:
- test_names = [] if test.passed else test.result.split(";")
- response_obj.response[test.question_id]["failures"] = test_names
+ failure_names = [] if test.passed else test.result.split(";")
+ elif test.return_code == 5:
+ failure_names = ["Could not parse user code."]
+ elif test.return_code == 6:
+ failure_names = ["Could not load user code."]
+ else:
+ failure_names = ["Internal error."]
+
+ response_obj.response[test.question_id]["failures"] = failure_names
# Report a failure on internal errors,
# or if the test suite doesn't allow failures