From 147425eefb8c5f154e7c5eeef63e859d3cb958d0 Mon Sep 17 00:00:00 2001 From: Jonathan Grynspan Date: Wed, 11 Sep 2024 14:22:37 -0400 Subject: [PATCH] Silence a concurrency warning on Linux/Windows building an actor-isolated test. We have one `@MainActor`, `async` test on a non-sendable `XCTestCase` subclass. Not surprisingly, this doesn't work fantastically well. Move the test out of the class to fix the resulting compiler diagnostic. Related to https://github.com/swiftlang/swift-package-manager/pull/7960. --- Tests/TestingTests/KnownIssueTests.swift | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Tests/TestingTests/KnownIssueTests.swift b/Tests/TestingTests/KnownIssueTests.swift index ac32f1a03..448b8e35d 100644 --- a/Tests/TestingTests/KnownIssueTests.swift +++ b/Tests/TestingTests/KnownIssueTests.swift @@ -376,12 +376,13 @@ final class KnownIssueTests: XCTestCase { await fulfillment(of: [issueRecorded, knownIssueNotRecorded], timeout: 0.0) } +} - @MainActor - func testMainActorIsolated() async { - await Test { - await withKnownIssue(isIntermittent: true) { () async in } - }.run(configuration: .init()) - } +@MainActor +@Test("withKnownIssue {} with main actor isolation") +func mainActorIsolatedKnownIssue() async { + await Test { + await withKnownIssue(isIntermittent: true) { () async in } + }.run(configuration: .init()) } #endif