From cbe3305dc51fffacc45a81b0daff01666fbfc3b3 Mon Sep 17 00:00:00 2001 From: Eric <5089238+emizzle@users.noreply.github.com> Date: Mon, 24 Mar 2025 17:20:59 +1100 Subject: [PATCH] Reinstate unittest > unittest2, move eventually to ./asynctest --- tests/asynctest.nim | 14 ++++++++++++-- tests/helpers.nim | 4 ---- tests/helpers/trackers.nim | 2 +- vendor/asynctest | 2 +- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/tests/asynctest.nim b/tests/asynctest.nim index 7c6a4afd..39492fa6 100644 --- a/tests/asynctest.nim +++ b/tests/asynctest.nim @@ -1,3 +1,13 @@ -import pkg/asynctest/chronos/unittest +import pkg/asynctest/chronos/unittest2 -export unittest +export unittest2 except eventually + +template eventually*(expression: untyped, timeout = 5000, pollInterval = 10): bool = + ## Fast defaults, do not use with HTTP connections! + eventually(expression, timeout, pollInterval) + +template eventuallySafe*( + expression: untyped, timeout = 5000, pollInterval = 1000 +): bool = + ## More sane defaults, for use with HTTP connections + eventually(expression, timeout = timeout, pollInterval = pollInterval) diff --git a/tests/helpers.nim b/tests/helpers.nim index cff99e60..643581ff 100644 --- a/tests/helpers.nim +++ b/tests/helpers.nim @@ -38,7 +38,3 @@ proc allFuturesThrowing*[T, E]( # https://github.com/nim-lang/Nim/issues/23432 ): Future[void] = allFuturesThrowing(futs.mapIt(FutureBase(it))) -template eventuallySafe*( - expression: untyped, timeout = 5000, pollInterval = 1000 -): bool = - eventually(expression, timeout, pollInterval) diff --git a/tests/helpers/trackers.nim b/tests/helpers/trackers.nim index ed8c5692..898053c2 100644 --- a/tests/helpers/trackers.nim +++ b/tests/helpers/trackers.nim @@ -1,5 +1,5 @@ import pkg/codex/streams/storestream -import std/unittest +import pkg/unittest2 # From lip2p/tests/helpers const trackerNames = [StoreStreamTrackerName] diff --git a/vendor/asynctest b/vendor/asynctest index 32df0f19..73c08f77 160000 --- a/vendor/asynctest +++ b/vendor/asynctest @@ -1 +1 @@ -Subproject commit 32df0f19d6e0e6f84c762cf8de7361ddb419f4ba +Subproject commit 73c08f77afc5cc2a5628d00f915b97bf72f70c9b