From 9040f70bced9a43efdf9f12f9d1ec9a05fead5e4 Mon Sep 17 00:00:00 2001 From: Tim de Jager Date: Fri, 20 Sep 2024 22:33:49 +0200 Subject: [PATCH] fix: satisfiability with new? async code --- src/lock_file/satisfiability.rs | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/lock_file/satisfiability.rs b/src/lock_file/satisfiability.rs index 50d525574..f538689a4 100644 --- a/src/lock_file/satisfiability.rs +++ b/src/lock_file/satisfiability.rs @@ -1232,6 +1232,7 @@ mod tests { use pep440_rs::Version; use rattler_lock::LockFile; use rstest::rstest; + use tokio::runtime::Handle; use super::*; use crate::Project; @@ -1317,20 +1318,22 @@ mod tests { } } - #[tokio::test] + #[tokio::test(flavor = "multi_thread")] async fn test_failing_satisiability() { let report_handler = NarratableReportHandler::new().with_cause_chain(); - - insta::glob!("../../tests/non-satisfiability", "*/pixi.toml", |path| { - let project = Project::from_path(path).unwrap(); - let lock_file = LockFile::from_path(&project.lock_file_path()).unwrap(); - let err = verify_lockfile_satisfiability(&project, &lock_file) - .await - .expect_err("expected failing satisfiability"); - - let mut s = String::new(); - report_handler.render_report(&mut s, &err).unwrap(); - insta::assert_snapshot!(s); + tokio::task::block_in_place(|| { + insta::glob!("../../tests/non-satisfiability", "*/pixi.toml", |path| { + let project = Project::from_path(path).unwrap(); + let lock_file = LockFile::from_path(&project.lock_file_path()).unwrap(); + let err = Handle::current().block_on(async { + verify_lockfile_satisfiability(&project, &lock_file) + .await + .expect_err("expected failing satisfiability") + }); + let mut s = String::new(); + report_handler.render_report(&mut s, &err).unwrap(); + insta::assert_snapshot!(s); + }); }); }