2023-03-24 16:42:49 +01:00
|
|
|
import unittest2, chronos
|
2021-05-21 10:27:01 -06:00
|
|
|
|
2023-03-24 16:42:49 +01:00
|
|
|
export unittest2, chronos
|
2021-05-21 10:27:01 -06:00
|
|
|
|
|
|
|
template asyncTeardown*(body: untyped): untyped =
|
|
|
|
teardown:
|
|
|
|
waitFor(
|
2024-06-11 17:18:06 +02:00
|
|
|
(
|
2023-12-05 08:05:32 +01:00
|
|
|
proc() {.async.} =
|
2021-05-21 10:27:01 -06:00
|
|
|
body
|
|
|
|
)()
|
2024-06-11 17:18:06 +02:00
|
|
|
)
|
2021-05-21 10:27:01 -06:00
|
|
|
|
|
|
|
template asyncSetup*(body: untyped): untyped =
|
|
|
|
setup:
|
|
|
|
waitFor(
|
2024-06-11 17:18:06 +02:00
|
|
|
(
|
2023-12-05 08:05:32 +01:00
|
|
|
proc() {.async.} =
|
2021-05-21 10:27:01 -06:00
|
|
|
body
|
|
|
|
)()
|
2024-06-11 17:18:06 +02:00
|
|
|
)
|
2021-05-21 10:27:01 -06:00
|
|
|
|
|
|
|
template asyncTest*(name: string, body: untyped): untyped =
|
|
|
|
test name:
|
|
|
|
waitFor(
|
2024-06-11 17:18:06 +02:00
|
|
|
(
|
2023-12-05 08:05:32 +01:00
|
|
|
proc() {.async.} =
|
2021-05-21 10:27:01 -06:00
|
|
|
body
|
|
|
|
)()
|
2024-06-11 17:18:06 +02:00
|
|
|
)
|