Skip to content

Commit

Permalink
Fix ignored tests when existing prematurely
Browse files Browse the repository at this point in the history
  • Loading branch information
niknetniko committed Sep 21, 2023
1 parent f079198 commit 0b7d6b2
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
11 changes: 7 additions & 4 deletions tested/judge/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down
3 changes: 1 addition & 2 deletions tested/judge/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion tested/judge/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 0b7d6b2

Please sign in to comment.