I've encountered this issue, I put a piece of code in a LazyLock to fetch a token that will be used for all tests, but that needs to run in a sync context, it panics if it's run inside async.
My quick and dirty solution was putting an init test not async to force the initialization, but I feel like this is bad, there has to be a better way.
#Run sync code before tokio::test's
14 messages · Page 1 of 1 (latest)
why does the fetching need to be run in sync?
A blocking Client API.
Unless there's some way to run async before all tests and share it
tests are also not necessarily ran sequentially
Yeah, that's why I want something better