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

I need a replacement for XCTContext.runActivity(named:) #42

Open
uhooi opened this issue Oct 1, 2023 · 4 comments
Open

I need a replacement for XCTContext.runActivity(named:) #42

uhooi opened this issue Oct 1, 2023 · 4 comments
Labels
enhancement New feature or request public-api Affects public API

Comments

@uhooi
Copy link
Contributor

uhooi commented Oct 1, 2023

Description

SSIA

I want to name each process in the test function.
I do not want to run it in the main thread.

image

Expected behavior

No response

Actual behavior

No response

Steps to reproduce

No response

swift-testing version/commit hash

70f5963

Swift & OS version (output of swift --version && uname -a)

$ swift --version && uname -a
swift-driver version: 1.87.1 Apple Swift version 5.9 (swiftlang-5.9.0.128.108 clang-1500.0.40.1)
Target: arm64-apple-macosx13.0
Darwin uhooinoMacBook-Air.local 22.6.0 Darwin Kernel Version 22.6.0: Wed Jul  5 22:22:52 PDT 2023; root:xnu-8796.141.3~6/RELEASE_ARM64_T8103 arm64
@uhooi uhooi added the enhancement New feature or request label Oct 1, 2023
@uhooi
Copy link
Contributor Author

uhooi commented Oct 1, 2023

A runtime error occurs.
スクリーンショット 2023-10-01 14 29 34

@grynspan
Copy link
Contributor

grynspan commented Oct 1, 2023

Thank you for filing! It would be very helpful if, instead of writing "SSIA", you could give us more information about the problem you're seeing. In this case, please tell us what you need runActivity() for so that we can better-understand your use case and figure out how to prioritize this request.

Regarding the error you're seeing: XCTContext.runActivity(named:) is main-thread-bound, but test functions in swift-testing run on arbitrary threads. You can resolve this runtime issue by adding @MainActor to the test function declaration.

@uhooi
Copy link
Contributor Author

uhooi commented Oct 1, 2023

@grynspan Thanks for the reply!
I was short on words.
I added it, please take a look.

@grynspan
Copy link
Contributor

grynspan commented Oct 1, 2023

Tracked internally as rdar://88647458.

@grynspan grynspan added the public-api Affects public API label Feb 26, 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
Projects
None yet
Development

No branches or pull requests

2 participants