Open nk9 opened 3 weeks ago
Also experiencing this issue, though only when the fixtures argument is passed. It does not occur with a plain sqlx::test
macro.
Does not cause the error message: #[sqlx::test]
(Migrations are applied successfully, in this case.)
Causes the error message: #[sqlx::test(fixtures("graphs")]
Edit: This was resolved by adding a pool: PgPool arg to the test function signature.
Yep, the code path that leads to the incorrect error is only triggered when the test
macro has arguments. And adding one of the various arguments to the function enables Automatic Test DB Management, which means the error is no longer necessary.
Bug Description
Summary
Error message implies that the "migrate" feature isn't enabled when it actually is. When the feature isn't enabled, the error doesn't mention that it's necessary.
Detail
I am receiving the following error message when I use
cargo test
:This error is generated on
test_attr.rs
:36:However, my setup DOES include the default
migrate
feature.Cargo.toml
The code above appears to give the extra "unless the
migrate
feature is enabled" wording only when… the migrate feature is enabled. (if cfg!(feature = "migrate")
) However, the time when that caveat is relevant is when themigrate
feature is not enabled. Otherwise, the error should just point to "automatic test DB management" as the issue.Minimal Reproduction
Cargo.toml
as above, withmain.rs
:Info
default
, andruntime-tokio-rustls
rustc --version
: rustc 1.78.0 (9b00956e5 2024-04-29)