swiftlang / swift-corelibs-xctest

The XCTest Project, A Swift core library for providing unit test support
swift.org
Apache License 2.0
1.15k stars 267 forks source link

Support XCTestExpectation creation APIs on XCTestCase from non-main threads #340

Closed stmontgomery closed 2 years ago

stmontgomery commented 2 years ago

This matches a behavior change made in the Xcode copy of XCTest and allows tests which call XCTestCase.expectation(description:) — as well as other XCTestCase APIs that return an XCTestExpectation — to do so from any thread. This removes a previous requirement that tests call these APIs from the main thread, and it allows existing tests using them to adopt async without requiring @MainActor.

rdar://85344643 rdar://79163972 rdar://81024086

stmontgomery commented 2 years ago

@swift-ci Please test