Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Test.isRunning to let code determine if Swift Testing is active. #514

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

grynspan
Copy link
Contributor

This PR adds a Test.isRunning static property that tells the caller if any thread/task/queue/etc. is currently running Swift Testing code. This property is distinct from Test.current because that property has a value of nil on detached tasks.

Resolves #475.

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 adds a `Test.isRunning` static property that tells the caller if _any_ thread/task/queue/etc. is currently running Swift Testing code. This property is distinct from `Test.current` because that property has a value of `nil` on detached tasks.

Resolves #475.
@grynspan grynspan added enhancement New feature or request tools integration Integration of swift-testing into tools/IDEs public-api Affects public API labels Jun 29, 2024
@grynspan grynspan self-assigned this Jun 29, 2024
@grynspan grynspan added this to the Swift 6.1 milestone Sep 10, 2024
@grynspan grynspan modified the milestones: Swift 6.1, Swift 6.2 Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request public-api Affects public API tools integration Integration of swift-testing into tools/IDEs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API to reliably detect if a test is running under Swift Testing or XCTest
1 participant