diff options
| author | jk <email@jkrause.io> | 2024-01-31 15:13:52 +0100 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2024-02-02 07:21:01 +0000 |
| commit | ab1450c655f7fdfc214e1556d16fc754ca684613 (patch) | |
| tree | 9ded305354a272d411059493e9475a3e39ff5cae /tests/pull.rs | |
| parent | ccdbc337ae16d7c70be44166269c8b2d5b9f5c09 (diff) | |
test: replace block_on with tokio::tests
This is intended to improve the reliabilty of the tests. there have been
particular issues with random tests never ending when run in the nix
configuration
see discussion here
https://github.com/DanConwayDev/ngit-cli/issues/
6#issuecomment-1918971239
and:
https://github.com/DanConwayDev/ngit-cli/pull/7
Diffstat (limited to 'tests/pull.rs')
| -rw-r--r-- | tests/pull.rs | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/tests/pull.rs b/tests/pull.rs index 9b88cb5..92d0ba9 100644 --- a/tests/pull.rs +++ b/tests/pull.rs | |||
| @@ -144,10 +144,10 @@ mod when_main_is_checked_out { | |||
| 144 | Ok(()) | 144 | Ok(()) |
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | #[test] | 147 | #[tokio::test] |
| 148 | #[serial] | 148 | #[serial] |
| 149 | fn cli_show_error() -> Result<()> { | 149 | async fn cli_show_error() -> Result<()> { |
| 150 | futures::executor::block_on(run_async_cli_show_error()) | 150 | run_async_cli_show_error().await |
| 151 | } | 151 | } |
| 152 | } | 152 | } |
| 153 | } | 153 | } |
| @@ -209,10 +209,10 @@ mod when_branch_doesnt_exist { | |||
| 209 | Ok(()) | 209 | Ok(()) |
| 210 | } | 210 | } |
| 211 | 211 | ||
| 212 | #[test] | 212 | #[tokio::test] |
| 213 | #[serial] | 213 | #[serial] |
| 214 | fn cli_show_error() -> Result<()> { | 214 | async fn cli_show_error() -> Result<()> { |
| 215 | futures::executor::block_on(run_async_cli_show_error()) | 215 | run_async_cli_show_error().await |
| 216 | } | 216 | } |
| 217 | } | 217 | } |
| 218 | } | 218 | } |
| @@ -274,10 +274,10 @@ mod when_branch_is_checked_out { | |||
| 274 | Ok(()) | 274 | Ok(()) |
| 275 | } | 275 | } |
| 276 | 276 | ||
| 277 | #[test] | 277 | #[tokio::test] |
| 278 | #[serial] | 278 | #[serial] |
| 279 | fn cli_show_up_to_date() -> Result<()> { | 279 | async fn cli_show_up_to_date() -> Result<()> { |
| 280 | futures::executor::block_on(run_async_cli_show_up_to_date()) | 280 | run_async_cli_show_up_to_date().await |
| 281 | } | 281 | } |
| 282 | } | 282 | } |
| 283 | } | 283 | } |
| @@ -389,17 +389,17 @@ mod when_branch_is_checked_out { | |||
| 389 | Ok(()) | 389 | Ok(()) |
| 390 | } | 390 | } |
| 391 | 391 | ||
| 392 | #[test] | 392 | #[tokio::test] |
| 393 | #[serial] | 393 | #[serial] |
| 394 | fn cli_applied_1_commit() -> Result<()> { | 394 | async fn cli_applied_1_commit() -> Result<()> { |
| 395 | futures::executor::block_on(run_async_cli_applied_1_commit()) | 395 | run_async_cli_applied_1_commit().await |
| 396 | } | 396 | } |
| 397 | } | 397 | } |
| 398 | 398 | ||
| 399 | #[test] | 399 | #[tokio::test] |
| 400 | #[serial] | 400 | #[serial] |
| 401 | fn pr_branch_tip_is_most_recent_patch() -> Result<()> { | 401 | async fn pr_branch_tip_is_most_recent_patch() -> Result<()> { |
| 402 | let (originating_repo, test_repo) = futures::executor::block_on(prep_and_run())?; | 402 | let (originating_repo, test_repo) = prep_and_run().await?; |
| 403 | assert_eq!( | 403 | assert_eq!( |
| 404 | originating_repo.get_tip_of_local_branch(FEATURE_BRANCH_NAME_1)?, | 404 | originating_repo.get_tip_of_local_branch(FEATURE_BRANCH_NAME_1)?, |
| 405 | test_repo.get_tip_of_local_branch(FEATURE_BRANCH_NAME_1)?, | 405 | test_repo.get_tip_of_local_branch(FEATURE_BRANCH_NAME_1)?, |