From d0999de3cadb28943b33459215c5b622b1cf621e Mon Sep 17 00:00:00 2001 From: Doran Penner Date: Tue, 14 May 2024 13:20:03 -0700 Subject: [PATCH 1/2] fix: properly handle student errors --- src/gapper/core/unittest_wrapper/wrapper_def.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gapper/core/unittest_wrapper/wrapper_def.py b/src/gapper/core/unittest_wrapper/wrapper_def.py index 1f70c33..0c716a9 100644 --- a/src/gapper/core/unittest_wrapper/wrapper_def.py +++ b/src/gapper/core/unittest_wrapper/wrapper_def.py @@ -16,6 +16,7 @@ from gapper.core.errors import ( InternalError, + StudentError, SubmissionSyntaxError, TestFailedError, ) @@ -143,8 +144,10 @@ def run_test(self, submission: Any, result: TestResult) -> TestResult: result.add_error( SubmissionSyntaxError(e), set_failed=result.is_pass_status_unset ) - except Exception as e: + except InternalError as e: result.add_error(InternalError(e), set_failed=result.is_pass_status_unset) + except Exception as e: + result.add_error(StudentError(e), set_failed=result.is_pass_status_unset) else: if result.is_pass_status_unset: result.set_pass_status("passed") From 8a875fc920d1fb8db61eeffeea295e000a945691 Mon Sep 17 00:00:00 2001 From: Doran Penner Date: Tue, 14 May 2024 13:24:42 -0700 Subject: [PATCH 2/2] (formatting) --- src/gapper/core/unittest_wrapper/wrapper_def.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gapper/core/unittest_wrapper/wrapper_def.py b/src/gapper/core/unittest_wrapper/wrapper_def.py index 0c716a9..18d9bd2 100644 --- a/src/gapper/core/unittest_wrapper/wrapper_def.py +++ b/src/gapper/core/unittest_wrapper/wrapper_def.py @@ -1,4 +1,5 @@ """TestCaseWrapper and related helper definitions.""" + from __future__ import annotations import logging