-
Notifications
You must be signed in to change notification settings - Fork 120
Labels
bugπͺ² Something isn't workingπͺ² Something isn't workingconcurrencyπ Swift concurrency/sendability issuesπ Swift concurrency/sendability issuesissue-handlingRelated to Issue handling within the testing libraryRelated to Issue handling within the testing libraryparameterized-testingRelated to parameterized testing functionalityRelated to parameterized testing functionalitytraitsIssues and PRs related to the trait subsystem or built-in traitsIssues and PRs related to the trait subsystem or built-in traitstriagedThis issue has undergone initial triageThis issue has undergone initial triage
Milestone
Description
Today, the task cancellation APIs behave inconsistently in Swift Testing:
UnsafeCurrentTask.cancel()
within a test body cancels the current test case but has no other observable effectsUnsafeCurrentTask.cancel()
during trait evaluation will cancel the entire test run (!)try Task.checkCancellation()
after task cancellation will record an error even though the test's task has been cancelled
Task.cancel()
and UnsafeCurrentTask.cancel()
don't throw, so they don't implicitly provide for early termination, but they can be paired with throw CancellationError()
or even just return
.
The only reasonable behaviour for task cancellation in a test target is that, if you cancel the task associated with a test, it cancels the test.
Metadata
Metadata
Assignees
Labels
bugπͺ² Something isn't workingπͺ² Something isn't workingconcurrencyπ Swift concurrency/sendability issuesπ Swift concurrency/sendability issuesissue-handlingRelated to Issue handling within the testing libraryRelated to Issue handling within the testing libraryparameterized-testingRelated to parameterized testing functionalityRelated to parameterized testing functionalitytraitsIssues and PRs related to the trait subsystem or built-in traitsIssues and PRs related to the trait subsystem or built-in traitstriagedThis issue has undergone initial triageThis issue has undergone initial triage