Skip to content

Commit

Permalink
fix: satisfiability with new? async code
Browse files Browse the repository at this point in the history
  • Loading branch information
tdejager committed Sep 20, 2024
1 parent 3e77599 commit 9040f70
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions src/lock_file/satisfiability.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
});
});
}

Expand Down

0 comments on commit 9040f70

Please sign in to comment.