Fix the current-thread runtime tests w/ sqlx
HEAD mainTracked upstream as https://github.com/launchbadge/sqlx/issues/3510
1 files changed, 3 insertions, 0 deletions
diff --git a/src/database/postgres/mod.rs b/src/database/postgres/mod.rs
index b705eed..8d67bb4 100644
--- a/src/database/postgres/mod.rs
+++ b/src/database/postgres/mod.rs
@@ -206,7 +206,10 @@ WHERE
let new_post = {
let mut post = old_post.clone();
+ #[cfg(not(test))] // Tests use the current-thread runtime.
tokio::task::block_in_place(|| f(&mut post));
+ #[cfg(test)]
+ f(&mut post);
post
};
|