diff options
author | 2021-06-02 04:06:00 +0300 | |
---|---|---|
committer | 2021-06-02 04:06:00 +0300 | |
commit | b98da9ae3693b40427077f69092b4b8ee69d2543 (patch) | |
tree | 64bcbdf573e8fd665f0fa05403b5266139ac142c /backend/routes/forms/unittesting.py | |
parent | Adds Code Question Model (diff) |
Records Failed Unittests
Adds logic for saving submissions of failed unittests. Updates schema
docs.
Signed-off-by: Hassan Abouelela <[email protected]>
Diffstat (limited to 'backend/routes/forms/unittesting.py')
-rw-r--r-- | backend/routes/forms/unittesting.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/backend/routes/forms/unittesting.py b/backend/routes/forms/unittesting.py index 590cb52..c23ff48 100644 --- a/backend/routes/forms/unittesting.py +++ b/backend/routes/forms/unittesting.py @@ -7,13 +7,15 @@ import httpx from httpx import HTTPStatusError from backend.constants import SNEKBOX_URL -from backend.models import FormResponse, Form +from backend.models import Form, FormResponse with open("resources/unittest_template.py") as file: TEST_TEMPLATE = file.read() -UnittestResult = namedtuple("UnittestResult", "question_id return_code passed result") +UnittestResult = namedtuple( + "UnittestResult", "question_id question_index return_code passed result" +) def filter_unittests(form: Form) -> Form: @@ -119,6 +121,7 @@ async def execute_unittest(form_response: FormResponse, form: Form) -> list[Unit unittest_results.append(UnittestResult( question_id=question.id, + question_index=index, return_code=return_code, passed=passed, result=result |