Skip to content

Commit 99a5c70

Browse files
Run test suite, setUp, and tearDown in the main actor
To keep consistency with the regular mode.
1 parent e428651 commit 99a5c70

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Sources/XCTest/Public/XCTestCase.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ open class XCTestCase: XCTest {
136136
}
137137

138138
#if USE_SWIFT_CONCURRENCY_WAITER
139-
internal func _invokeTestAsync() async {
139+
@MainActor internal func _invokeTestAsync() async {
140140
await performSetUpSequence()
141141

142142
do {
@@ -311,7 +311,7 @@ open class XCTestCase: XCTest {
311311
}
312312

313313
#if USE_SWIFT_CONCURRENCY_WAITER
314-
private func runTeardownBlocks() async {
314+
@MainActor private func runTeardownBlocks() async {
315315
for block in self.teardownBlocksState.finalize().reversed() {
316316
do {
317317
try await block()
@@ -321,7 +321,7 @@ open class XCTestCase: XCTest {
321321
}
322322
}
323323

324-
private func performSetUpSequence() async {
324+
@MainActor private func performSetUpSequence() async {
325325
do {
326326
if #available(macOS 12.0, *) {
327327
try await self.setUp()
@@ -333,7 +333,7 @@ open class XCTestCase: XCTest {
333333
performPostSetup()
334334
}
335335

336-
private func performTearDownSequence() async {
336+
@MainActor private func performTearDownSequence() async {
337337
await runTeardownBlocks()
338338
performSyncTearDown()
339339

0 commit comments

Comments
 (0)