From 06337a0512643d13bc7ebe1b1ac7669589ff64d3 Mon Sep 17 00:00:00 2001 From: Eric <5089238+emizzle@users.noreply.github.com> Date: Fri, 14 Mar 2025 16:57:22 +1100 Subject: [PATCH] ensure runTests doesn't raise CancelledError TrackedFutures now only accepts Futures that do not raise any exceptions --- tests/integration/testmanager.nim | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/tests/integration/testmanager.nim b/tests/integration/testmanager.nim index cd00e108..2bba3b0e 100644 --- a/tests/integration/testmanager.nim +++ b/tests/integration/testmanager.nim @@ -640,7 +640,7 @@ proc run(test: IntegrationTest) {.async: (raises: []).} = of IntegrationTestStatus.Ok: notice "Test passed" -proc runTests(manager: TestManager) {.async: (raises: [CancelledError]).} = +proc runTests(manager: TestManager) {.async: (raises: []).} = var testFutures: seq[Future[void]] manager.timeStart = some Moment.now() @@ -658,14 +658,15 @@ proc runTests(manager: TestManager) {.async: (raises: [CancelledError]).} = let futRun = test.run() testFutures.add futRun - defer: + try: + await allFutures testFutures + manager.timeEnd = some Moment.now() + except CancelledError as e: + discard + finally: for fut in testFutures: await fut.cancelAndWait() - await allFutures testFutures - - manager.timeEnd = some Moment.now() - proc withBorder( msg: string, align = Align.Left, width = 67, borders = {Border.Left, Border.Right} ): string =