diff --git a/tested/judge/collector.py b/tested/judge/collector.py index 82cc2ec9..35752fab 100644 --- a/tested/judge/collector.py +++ b/tested/judge/collector.py @@ -112,26 +112,29 @@ def terminate( assert isinstance(status_if_unclosed, StatusMessage) status = status_if_unclosed - self.add(EscalateStatus(status=status)) + if status.enum != Status.CORRECT: + self.add(EscalateStatus(status=status)) + + open_tab, open_context, open_testcase = self.currently_open while self.open_stack: open_level = self.open_stack[-1] if open_level == "test": self.add(CloseTest(generated="", status=status)) elif open_level == "testcase": - self.add(CloseTestcase(accepted=False)) + self.add(CloseTestcase(accepted=False), open_testcase) if until == open_level: return elif open_level == "context": if until == "testcase": return - self.add(CloseContext()) + self.add(CloseContext(), open_context) if until == open_level: return elif open_level == "tab": if until in ("context", "testcase"): return - self.add(CloseTab()) + self.add(CloseTab(), open_tab) if until == open_level: return elif open_level == "judgement": diff --git a/tested/judge/core.py b/tested/judge/core.py index c0a19d18..57b58968 100644 --- a/tested/judge/core.py +++ b/tested/judge/core.py @@ -200,8 +200,7 @@ def _process_one_unit( return # Close the last tab. - collector.add(CloseTab(), currently_open_tab) - collector.add(CloseJudgement()) + terminate(bundle, collector, Status.CORRECT) def _execute_one_unit( diff --git a/tested/judge/evaluation.py b/tested/judge/evaluation.py index bbbf27eb..dbb94992 100644 --- a/tested/judge/evaluation.py +++ b/tested/judge/evaluation.py @@ -523,7 +523,7 @@ def complete_evaluation(bundle: Bundle, collector: OutputManager): collector.add(CloseContext(accepted=False)) collector.add(CloseTab()) context_start = 0 # For the next tab, start from the beginning. - collector.add(CloseJudgement(accepted=False)) + collector.add(CloseJudgement()) def terminate(