#Equivalent to @Setup/@BeforeAll in rust
5 messages · Page 1 of 1 (latest)
Tests ideally shouldn't depend on any state outside themselves and thus shouldn't need setup code.
But if you have to anyway, then a OnceCell is a perfectly good answer.
If you don't actually need to carry any data but just an initialization flag, then you can use https://doc.rust-lang.org/std/sync/struct.Once.html
it's not so much state that the tests depend on, mostly boiler plate like setting up logging