Skip to content

Extend test/task cancellation support to test case evaluation.#1297

Merged
grynspan merged 1 commit into
mainfrom
jgrynspan/cancellation-during-test-case-evaluation
Sep 2, 2025
Merged

Extend test/task cancellation support to test case evaluation.#1297
grynspan merged 1 commit into
mainfrom
jgrynspan/cancellation-during-test-case-evaluation

Conversation

@grynspan

@grynspan grynspan commented Sep 2, 2025

Copy link
Copy Markdown
Contributor

This PR extends the special-casing of SkipInfo and CancellationError added in #1284 to also cover test case evaluation during test planning. If either error is thrown from evaluateTestCases(), we treat it as test cancellation the same way we do for trait evaluation.

Example:

func websites() async throws -> [Website] {
  guard let www = Web() else {
    try Test.cancel("The Web doesn't exist, is this 1992?")
  }
  return try await www.downloadEverything()
}

@Test(arguments: try await websites())
func browseWeb(at website: Website) { ... }

Checklist:

  • Code and documentation should follow the style of the Style Guide.
  • If public symbols are renamed or modified, DocC references should be updated.

This PR extends the special-casing of `SkipInfo` and `CancellationError` added
in #1284 to also cover test case evaluation during test planning. If either
error is thrown from `evaluateTestCases()`, we treat it as test cancellation
the same way we do for trait evaluation.
@grynspan grynspan self-assigned this Sep 2, 2025
@grynspan grynspan added enhancement New feature or request public-api Affects public API issue-handling Related to Issue handling within the testing library parameterized-testing Related to parameterized testing functionality labels Sep 2, 2025
@grynspan grynspan added this to the Swift 6.x (main) milestone Sep 2, 2025
@grynspan

grynspan commented Sep 2, 2025

Copy link
Copy Markdown
Contributor Author

@swift-ci test

@grynspan grynspan merged commit 5089e36 into main Sep 2, 2025
3 checks passed
@grynspan grynspan deleted the jgrynspan/cancellation-during-test-case-evaluation branch September 2, 2025 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request issue-handling Related to Issue handling within the testing library parameterized-testing Related to parameterized testing functionality public-api Affects public API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants