File tree Expand file tree Collapse file tree 3 files changed +14
-3
lines changed Expand file tree Collapse file tree 3 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -202,7 +202,7 @@ jobs:
202202 run : cargo +${{ matrix.rust }} version
203203
204204 - name : Test diesel_async
205- run : cargo +${{ matrix.rust }} test --manifest-path Cargo.toml --no-default-features --features "${{ matrix.backend }} deadpool bb8 mobc"
205+ run : cargo +${{ matrix.rust }} test --manifest-path Cargo.toml --no-default-features --features "${{ matrix.backend }} deadpool bb8 mobc async-connection-wrapper "
206206
207207 - name : Run examples (Postgres)
208208 if : matrix.backend == 'postgres'
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ pub trait BlockOn {
4343///
4444/// # Examples
4545///
46- /// ```rust
46+ /// ```rust,no_run
4747/// # include!("doctest_setup.rs");
4848/// use schema::users;
4949/// use diesel_async::async_connection_wrapper::AsyncConnectionWrapper;
@@ -61,7 +61,7 @@ pub trait BlockOn {
6161///
6262/// If you are in the scope of an existing tokio runtime you need to use
6363/// `tokio::task::spawn_blocking` to encapsulate the blocking tasks
64- /// ```rust
64+ /// ```rust,no_run
6565/// # include!("doctest_setup.rs");
6666/// use schema::users;
6767/// use diesel_async::async_connection_wrapper::AsyncConnectionWrapper;
Original file line number Diff line number Diff line change @@ -6,6 +6,17 @@ use diesel_async::async_connection_wrapper::AsyncConnectionWrapper;
66fn test_sync_wrapper ( ) {
77 use diesel:: RunQueryDsl ;
88
9+ // The runtime is required for the `sqlite` implementation to be able to use
10+ // `spawn_blocking()`. This is not required for `postgres` or `mysql`.
11+ #[ cfg( feature = "sqlite" ) ]
12+ let rt = tokio:: runtime:: Builder :: new_current_thread ( )
13+ . enable_io ( )
14+ . build ( )
15+ . unwrap ( ) ;
16+
17+ #[ cfg( feature = "sqlite" ) ]
18+ let _guard = rt. enter ( ) ;
19+
920 let db_url = std:: env:: var ( "DATABASE_URL" ) . unwrap ( ) ;
1021 let mut conn = AsyncConnectionWrapper :: < crate :: TestConnection > :: establish ( & db_url) . unwrap ( ) ;
1122
You can’t perform that action at this time.
0 commit comments