Feature request: `flavor = "multi_thread"` support for `#[sqlx::test]`
Is your feature request related to a problem? Please describe. From documentation:
#[sqlx::test]does not recognize any of the control arguments supported by#[tokio::test]as that would have complicated the implementation. If your use case requires any of those, feel free to open an issue.
Thus this issue.
Describe the solution you'd like
#[sqlx::test(tokio_flavor = "multi_thread", tokio_threads = 1)]
Describe alternatives you've considered
- Reimplementing
#[sqlx::test]manually in my project without a macro- Tedious
- A second macro that would spawn a multi-threaded runtime
- ~~Having
#[sqlx::test]not spawn a runtime for non-async functions~~ May not be feasible due to how the macro is structured- This would allow me to bring my own
#[tokio::test]invocation, since the Tokio macros de-asyncifiy the functions they're used on.
- This would allow me to bring my own
- Just spawn a multi-threaded runtime by default
Additional context n/a
I'd accept a PR to support this:
#[sqlx::test(tokio(...))]
and then we don't have to parse ..., we can just pass it directly to #[tokio::test(...)].
The problem is, that's not currently how it works internally (it expands to more than just #[tokio::test]), so we'd need to move some stuff around.
Hello! Is it possible to enable several threads in an sqlx::test?
I'd accept a PR to support this:
#[sqlx::test(tokio(...))]
This would be super helpful! I'd like to combine #[sqlx::test] with #[tokio::test(start_paused = true)]