File tree 3 files changed +14
-3
lines changed
3 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -202,7 +202,7 @@ jobs:
202
202
run : cargo +${{ matrix.rust }} version
203
203
204
204
- 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 "
206
206
207
207
- name : Run examples (Postgres)
208
208
if : matrix.backend == 'postgres'
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ pub trait BlockOn {
43
43
///
44
44
/// # Examples
45
45
///
46
- /// ```rust
46
+ /// ```rust,no_run
47
47
/// # include!("doctest_setup.rs");
48
48
/// use schema::users;
49
49
/// use diesel_async::async_connection_wrapper::AsyncConnectionWrapper;
@@ -61,7 +61,7 @@ pub trait BlockOn {
61
61
///
62
62
/// If you are in the scope of an existing tokio runtime you need to use
63
63
/// `tokio::task::spawn_blocking` to encapsulate the blocking tasks
64
- /// ```rust
64
+ /// ```rust,no_run
65
65
/// # include!("doctest_setup.rs");
66
66
/// use schema::users;
67
67
/// 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;
6
6
fn test_sync_wrapper ( ) {
7
7
use diesel:: RunQueryDsl ;
8
8
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
+
9
20
let db_url = std:: env:: var ( "DATABASE_URL" ) . unwrap ( ) ;
10
21
let mut conn = AsyncConnectionWrapper :: < crate :: TestConnection > :: establish ( & db_url) . unwrap ( ) ;
11
22
You can’t perform that action at this time.
0 commit comments