Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelzw committed Oct 26, 2024
1 parent efb7233 commit 47b23b6
Showing 1 changed file with 7 additions and 16 deletions.
23 changes: 7 additions & 16 deletions crates/rattler_conda_types/src/repo_data/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ mod test {
}

#[test]
fn test_validate_package_records() {
fn test_validate() {
// load test data
let test_data_path = dunce::canonicalize(
std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../../test-data"),
Expand All @@ -653,29 +653,20 @@ mod test {
let package_bors_1 = repodata.packages.get("bors-1.2.1-bla_1.tar.bz2").unwrap();
let package_bors_2 = repodata.packages.get("bors-2.1-bla_1.tar.bz2").unwrap();

assert!(PackageRecord::validate_package_records(vec![
package_depends_only_virtual_package
])
.is_ok());
assert!(PackageRecord::validate(vec![package_depends_only_virtual_package]).is_ok());
for packages in vec![vec![package_depends], vec![package_depends, package_bors_2]] {

Check failure on line 657 in crates/rattler_conda_types/src/repo_data/mod.rs

View workflow job for this annotation

GitHub Actions / Format and Lint

useless use of `vec!`
let result = PackageRecord::validate_package_records(packages);
let result = PackageRecord::validate(packages);
assert!(result.is_err());
assert!(result.err().unwrap().to_string().contains(
"package 'foobar' has dependency 'bors <2.0', which is not in the environment"
));
}

assert!(
PackageRecord::validate_package_records(vec![package_depends, package_bors_1]).is_ok()
);
assert!(PackageRecord::validate_package_records(vec![package_constrains]).is_ok());
assert!(
PackageRecord::validate_package_records(vec![package_constrains, package_bors_1])
.is_ok()
);
assert!(PackageRecord::validate(vec![package_depends, package_bors_1]).is_ok());
assert!(PackageRecord::validate(vec![package_constrains]).is_ok());
assert!(PackageRecord::validate(vec![package_constrains, package_bors_1]).is_ok());

let result =
PackageRecord::validate_package_records(vec![package_constrains, package_bors_2]);
let result = PackageRecord::validate(vec![package_constrains, package_bors_2]);
assert!(result.is_err());
assert!(result.err().unwrap().to_string().contains(
"package 'foo' has constraint 'bors <2.0', which is not satisfied by 'bors=2.1=bla_1' in the environment"
Expand Down

0 comments on commit 47b23b6

Please sign in to comment.