ensure runTests doesn't raise CancelledError

TrackedFutures now only accepts Futures that do not raise any exceptions
This commit is contained in:
Eric 2025-03-14 16:57:22 +11:00
parent 338ee181d3
commit 6d1b924c41
No known key found for this signature in database

View File

@ -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 =