Skip to content

Executing tests on a spawned thread #284

Answered by ilslv
niclo asked this question in Q&A
May 22, 2023 · 1 comments · 3 replies
Discussion options

You must be logged in to vote

@niclo in case your tests do not contain significant blocking logic, there is no need to run tests in a separate thread. Just use .await. In case there is blocking code, you should wrap it in a tokio::spawn_blocking.

Alternatively you can spawn a thread, spin up a new tokio runtime and then block on World::run().

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@niclo
Comment options

@ilslv
Comment options

Answer selected by ilslv
@niclo
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants