From d706f13c29c95fb3987a00591b0f5db74d16ab19 Mon Sep 17 00:00:00 2001 From: ra1028 Date: Fri, 3 Oct 2025 16:36:46 +0900 Subject: [PATCH] Set high priority to the tasks for suspending unit test context --- Sources/Atoms/Context/AtomTestContext.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Sources/Atoms/Context/AtomTestContext.swift b/Sources/Atoms/Context/AtomTestContext.swift index 884ebeb7..3bbe6682 100644 --- a/Sources/Atoms/Context/AtomTestContext.swift +++ b/Sources/Atoms/Context/AtomTestContext.swift @@ -52,7 +52,7 @@ public struct AtomTestContext: AtomWatchableContext { await withTaskGroup(of: Bool.self) { group in let updates = _state.makeUpdateStream() - group.addTask { @MainActor @Sendable in + group.addTask(priority: .high) { @MainActor @Sendable in for await _ in updates { return true } @@ -60,7 +60,7 @@ public struct AtomTestContext: AtomWatchableContext { } if let duration { - group.addTask { + group.addTask(priority: .high) { try? await Task.sleep(seconds: duration) return false } @@ -121,7 +121,7 @@ public struct AtomTestContext: AtomWatchableContext { let updates = _state.makeUpdateStream() - group.addTask { @MainActor @Sendable in + group.addTask(priority: .high) { @MainActor @Sendable in guard !check() else { return false } @@ -136,7 +136,7 @@ public struct AtomTestContext: AtomWatchableContext { } if let duration { - group.addTask { + group.addTask(priority: .high) { try? await Task.sleep(seconds: duration) return false }