@@ -13,12 +13,13 @@ use pgt_configuration::database::PartialDatabaseConfiguration;
1313use pgt_fs:: MemoryFileSystem ;
1414use pgt_lsp:: LSPServer ;
1515use pgt_lsp:: ServerFactory ;
16- use pgt_test_utils:: test_database:: get_new_test_db;
1716use pgt_workspace:: DynRef ;
1817use serde:: Serialize ;
1918use serde:: de:: DeserializeOwned ;
2019use serde_json:: Value ;
2120use serde_json:: { from_value, to_value} ;
21+ use sqlx:: Executor ;
22+ use sqlx:: PgPool ;
2223use std:: any:: type_name;
2324use std:: fmt:: Display ;
2425use std:: time:: Duration ;
@@ -344,11 +345,10 @@ async fn basic_lifecycle() -> Result<()> {
344345 Ok ( ( ) )
345346}
346347
347- #[ tokio :: test]
348- async fn test_database_connection ( ) -> Result < ( ) > {
348+ #[ sqlx :: test( migrator = "pgt_test_utils::MIGRATIONS" ) ]
349+ async fn test_database_connection ( test_db : PgPool ) -> Result < ( ) > {
349350 let factory = ServerFactory :: default ( ) ;
350351 let mut fs = MemoryFileSystem :: default ( ) ;
351- let test_db = get_new_test_db ( ) . await ;
352352
353353 let setup = r#"
354354 create table public.users (
@@ -456,11 +456,10 @@ async fn server_shutdown() -> Result<()> {
456456 Ok ( ( ) )
457457}
458458
459- #[ tokio :: test]
460- async fn test_completions ( ) -> Result < ( ) > {
459+ #[ sqlx :: test( migrator = "pgt_test_utils::MIGRATIONS" ) ]
460+ async fn test_completions ( test_db : PgPool ) -> Result < ( ) > {
461461 let factory = ServerFactory :: default ( ) ;
462462 let mut fs = MemoryFileSystem :: default ( ) ;
463- let test_db = get_new_test_db ( ) . await ;
464463
465464 let setup = r#"
466465 create table public.users (
@@ -557,11 +556,10 @@ async fn test_completions() -> Result<()> {
557556 Ok ( ( ) )
558557}
559558
560- #[ tokio :: test]
561- async fn test_issue_271 ( ) -> Result < ( ) > {
559+ #[ sqlx :: test( migrator = "pgt_test_utils::MIGRATIONS" ) ]
560+ async fn test_issue_271 ( test_db : PgPool ) -> Result < ( ) > {
562561 let factory = ServerFactory :: default ( ) ;
563562 let mut fs = MemoryFileSystem :: default ( ) ;
564- let test_db = get_new_test_db ( ) . await ;
565563
566564 let setup = r#"
567565 create table public.users (
@@ -759,11 +757,10 @@ async fn test_issue_271() -> Result<()> {
759757 Ok ( ( ) )
760758}
761759
762- #[ tokio :: test]
763- async fn test_execute_statement ( ) -> Result < ( ) > {
760+ #[ sqlx :: test( migrator = "pgt_test_utils::MIGRATIONS" ) ]
761+ async fn test_execute_statement ( test_db : PgPool ) -> Result < ( ) > {
764762 let factory = ServerFactory :: default ( ) ;
765763 let mut fs = MemoryFileSystem :: default ( ) ;
766- let test_db = get_new_test_db ( ) . await ;
767764
768765 let database = test_db
769766 . connect_options ( )
@@ -898,11 +895,10 @@ async fn test_execute_statement() -> Result<()> {
898895 Ok ( ( ) )
899896}
900897
901- #[ tokio :: test]
902- async fn test_issue_281 ( ) -> Result < ( ) > {
898+ #[ sqlx :: test( migrator = "pgt_test_utils::MIGRATIONS" ) ]
899+ async fn test_issue_281 ( test_db : PgPool ) -> Result < ( ) > {
903900 let factory = ServerFactory :: default ( ) ;
904901 let mut fs = MemoryFileSystem :: default ( ) ;
905- let test_db = get_new_test_db ( ) . await ;
906902
907903 let setup = r#"
908904 create table public.users (
@@ -982,11 +978,10 @@ async fn test_issue_281() -> Result<()> {
982978 Ok ( ( ) )
983979}
984980
985- #[ tokio :: test]
986- async fn test_issue_303 ( ) -> Result < ( ) > {
981+ #[ sqlx :: test( migrator = "pgt_test_utils::MIGRATIONS" ) ]
982+ async fn test_issue_303 ( test_db : PgPool ) -> Result < ( ) > {
987983 let factory = ServerFactory :: default ( ) ;
988984 let mut fs = MemoryFileSystem :: default ( ) ;
989- let test_db = get_new_test_db ( ) . await ;
990985
991986 let setup = r#"
992987 create table public.users (
0 commit comments