Description: Gate MySQL derive/macro tests on runtime features
Author: Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
Origin: vendor
Forwarded: not-needed
Last-Update: 2026-08-22
---
--- a/tests/mysql/derives.rs
+++ b/tests/mysql/derives.rs
@@ -2,6 +2,7 @@ use sqlx_mysql::MySql;
 use sqlx_test::{new, test_type};
 
 #[sqlx::test]
+#[cfg(any(feature = "runtime-async-std", feature = "runtime-tokio"))]
 async fn test_derive_strong_enum() -> anyhow::Result<()> {
     #[derive(sqlx::Type, PartialEq, Eq, Debug)]
     #[sqlx(rename_all = "PascalCase")]
@@ -144,6 +145,7 @@ async fn test_derive_strong_enum() -> an
 }
 
 #[sqlx::test]
+#[cfg(any(feature = "runtime-async-std", feature = "runtime-tokio"))]
 async fn test_derive_weak_enum() -> anyhow::Result<()> {
     #[derive(sqlx::Type, Debug, PartialEq, Eq)]
     #[repr(i8)]
--- a/tests/mysql/macros.rs
+++ b/tests/mysql/macros.rs
@@ -2,6 +2,7 @@ use sqlx::{Connection, MySql, MySqlConne
 use sqlx_test::new;
 
 #[sqlx_macros::test]
+#[cfg(any(feature = "runtime-async-std", feature = "runtime-tokio"))]
 async fn macro_select_from_cte() -> anyhow::Result<()> {
     let mut conn = new::<MySql>().await?;
     let account =
@@ -18,6 +19,7 @@ async fn macro_select_from_cte() -> anyh
 }
 
 #[sqlx_macros::test]
+#[cfg(any(feature = "runtime-async-std", feature = "runtime-tokio"))]
 async fn macro_select_from_cte_bind() -> anyhow::Result<()> {
     let mut conn = new::<MySql>().await?;
     let account = sqlx::query!(
@@ -40,6 +42,7 @@ struct RawAccount {
 }
 
 #[sqlx_macros::test]
+#[cfg(any(feature = "runtime-async-std", feature = "runtime-tokio"))]
 async fn test_query_as_raw() -> anyhow::Result<()> {
     let mut conn = new::<MySql>().await?;
 
@@ -59,6 +62,7 @@ async fn test_query_as_raw() -> anyhow::
 }
 
 #[sqlx_macros::test]
+#[cfg(any(feature = "runtime-async-std", feature = "runtime-tokio"))]
 async fn test_query_scalar() -> anyhow::Result<()> {
     let mut conn = new::<MySql>().await?;
 
@@ -125,6 +129,7 @@ async fn test_query_scalar() -> anyhow::
 }
 
 #[sqlx_macros::test]
+#[cfg(any(feature = "runtime-async-std", feature = "runtime-tokio"))]
 async fn test_query_as_bool() -> anyhow::Result<()> {
     let mut conn = new::<MySql>().await?;
 
@@ -147,6 +152,7 @@ async fn test_query_as_bool() -> anyhow:
 }
 
 #[sqlx_macros::test]
+#[cfg(any(feature = "runtime-async-std", feature = "runtime-tokio"))]
 async fn test_query_bytes() -> anyhow::Result<()> {
     let mut conn = new::<MySql>().await?;
 
@@ -160,6 +166,7 @@ async fn test_query_bytes() -> anyhow::R
 }
 
 #[sqlx_macros::test]
+#[cfg(any(feature = "runtime-async-std", feature = "runtime-tokio"))]
 async fn test_column_override_not_null() -> anyhow::Result<()> {
     let mut conn = new::<MySql>().await?;
 
@@ -173,6 +180,7 @@ async fn test_column_override_not_null()
 }
 
 #[sqlx_macros::test]
+#[cfg(any(feature = "runtime-async-std", feature = "runtime-tokio"))]
 async fn test_column_override_nullable() -> anyhow::Result<()> {
     let mut conn = new::<MySql>().await?;
 
@@ -210,6 +218,7 @@ struct OptionalRecord {
 }
 
 #[sqlx_macros::test]
+#[cfg(any(feature = "runtime-async-std", feature = "runtime-tokio"))]
 async fn test_column_override_wildcard() -> anyhow::Result<()> {
     let mut conn = new::<MySql>().await?;
     let (mut conn, id) = with_test_row(&mut conn).await?;
@@ -237,6 +246,7 @@ async fn test_column_override_wildcard()
 }
 
 #[sqlx_macros::test]
+#[cfg(any(feature = "runtime-async-std", feature = "runtime-tokio"))]
 async fn test_column_override_wildcard_not_null() -> anyhow::Result<()> {
     let mut conn = new::<MySql>().await?;
     let (mut conn, _) = with_test_row(&mut conn).await?;
@@ -251,6 +261,7 @@ async fn test_column_override_wildcard_n
 }
 
 #[sqlx_macros::test]
+#[cfg(any(feature = "runtime-async-std", feature = "runtime-tokio"))]
 async fn test_column_override_wildcard_nullable() -> anyhow::Result<()> {
     let mut conn = new::<MySql>().await?;
     let (mut conn, id) = with_test_row(&mut conn).await?;
@@ -265,6 +276,7 @@ async fn test_column_override_wildcard_n
 }
 
 #[sqlx_macros::test]
+#[cfg(any(feature = "runtime-async-std", feature = "runtime-tokio"))]
 async fn test_column_override_exact() -> anyhow::Result<()> {
     let mut conn = new::<MySql>().await?;
     let (mut conn, id) = with_test_row(&mut conn).await?;
@@ -292,6 +304,7 @@ async fn test_column_override_exact() ->
 }
 
 #[sqlx_macros::test]
+#[cfg(any(feature = "runtime-async-std", feature = "runtime-tokio"))]
 async fn test_column_override_exact_not_null() -> anyhow::Result<()> {
     let mut conn = new::<MySql>().await?;
     let (mut conn, _) = with_test_row(&mut conn).await?;
@@ -306,6 +319,7 @@ async fn test_column_override_exact_not_
 }
 
 #[sqlx_macros::test]
+#[cfg(any(feature = "runtime-async-std", feature = "runtime-tokio"))]
 async fn test_column_override_exact_nullable() -> anyhow::Result<()> {
     let mut conn = new::<MySql>().await?;
     let (mut conn, id) = with_test_row(&mut conn).await?;
@@ -336,6 +350,7 @@ enum MyCEnum {
 }
 
 #[sqlx_macros::test]
+#[cfg(any(feature = "runtime-async-std", feature = "runtime-tokio"))]
 async fn test_column_override_exact_enum() -> anyhow::Result<()> {
     let mut conn = new::<MySql>().await?;
 
@@ -355,6 +370,7 @@ async fn test_column_override_exact_enum
 }
 
 #[sqlx_macros::test]
+#[cfg(any(feature = "runtime-async-std", feature = "runtime-tokio"))]
 async fn test_try_from_attr_for_native_type() -> anyhow::Result<()> {
     #[derive(sqlx::FromRow)]
     struct Record {
@@ -375,6 +391,7 @@ async fn test_try_from_attr_for_native_t
 }
 
 #[sqlx_macros::test]
+#[cfg(any(feature = "runtime-async-std", feature = "runtime-tokio"))]
 async fn test_try_from_attr_for_custom_type() -> anyhow::Result<()> {
     #[derive(sqlx::FromRow)]
     struct Record {
@@ -404,6 +421,7 @@ async fn test_try_from_attr_for_custom_t
 }
 
 #[sqlx_macros::test]
+#[cfg(any(feature = "runtime-async-std", feature = "runtime-tokio"))]
 async fn test_try_from_attr_with_flatten() -> anyhow::Result<()> {
     #[derive(sqlx::FromRow)]
     struct Record {
@@ -436,6 +454,7 @@ async fn test_try_from_attr_with_flatten
 }
 
 #[sqlx_macros::test]
+#[cfg(any(feature = "runtime-async-std", feature = "runtime-tokio"))]
 async fn test_try_from_attr_with_complex_type() -> anyhow::Result<()> {
     mod m {
         #[derive(sqlx::Type)]
@@ -469,6 +488,7 @@ async fn test_try_from_attr_with_complex
 }
 
 #[sqlx_macros::test]
+#[cfg(any(feature = "runtime-async-std", feature = "runtime-tokio"))]
 async fn test_from_row_json_attr() -> anyhow::Result<()> {
     #[derive(serde::Deserialize)]
     struct J {
@@ -495,6 +515,7 @@ async fn test_from_row_json_attr() -> an
 }
 
 #[sqlx_macros::test]
+#[cfg(any(feature = "runtime-async-std", feature = "runtime-tokio"))]
 async fn test_from_row_json_attr_nullable() -> anyhow::Result<()> {
     #[derive(serde::Deserialize)]
     #[allow(dead_code)]
@@ -520,6 +541,7 @@ async fn test_from_row_json_attr_nullabl
 }
 
 #[sqlx_macros::test]
+#[cfg(any(feature = "runtime-async-std", feature = "runtime-tokio"))]
 async fn test_from_row_json_try_from_attr() -> anyhow::Result<()> {
     #[derive(serde::Deserialize)]
     struct J {
@@ -557,6 +579,7 @@ async fn test_from_row_json_try_from_att
 
 #[cfg(all(mariadb, not(mariadb = "10_6"), feature = "time"))]
 #[sqlx_macros::test]
+#[cfg(any(feature = "runtime-async-std", feature = "runtime-tokio"))]
 async fn test_uuid_is_compatible_mariadb() -> anyhow::Result<()> {
     use sqlx::types::time::OffsetDateTime;
     use sqlx::types::Uuid;
