From 9b97d9087fd12fb219ac8bb3469cffc64db126bb Mon Sep 17 00:00:00 2001 From: Bas Zalmstra Date: Mon, 7 Oct 2024 12:06:27 +0200 Subject: [PATCH] fix: sorting test should also load dependencies (#896) --- .../sorting__test_ordering_abess.snap | 14 ++--- .../sorting__test_ordering_python.snap | 8 +-- .../sorting__test_ordering_pytorch.snap | 60 +++++++++---------- crates/rattler_solve/tests/sorting.rs | 13 ++-- 4 files changed, 47 insertions(+), 48 deletions(-) diff --git a/crates/rattler_solve/tests/snapshots/sorting__test_ordering_abess.snap b/crates/rattler_solve/tests/snapshots/sorting__test_ordering_abess.snap index ab79e6c6e..e0aa48316 100644 --- a/crates/rattler_solve/tests/snapshots/sorting__test_ordering_abess.snap +++ b/crates/rattler_solve/tests/snapshots/sorting__test_ordering_abess.snap @@ -1,17 +1,17 @@ --- source: crates/rattler_solve/tests/sorting.rs -expression: create_sorting_snapshot(package_name) +expression: create_sorting_snapshot(spec) --- +abess=0.4.5=py310hc4a4660_1 abess=0.4.5=py39hac2352c_1 -abess=0.4.5=py37h48bf904_1 abess=0.4.5=py38h514daf8_1 -abess=0.4.5=py310hc4a4660_1 -abess=0.4.5=py37h48bf904_0 -abess=0.4.5=py38h514daf8_0 +abess=0.4.5=py37h48bf904_1 abess=0.4.5=py39hac2352c_0 +abess=0.4.5=py38h514daf8_0 +abess=0.4.5=py37h48bf904_0 +abess=0.4.4=py39hac2352c_1 abess=0.4.4=py38h514daf8_1 abess=0.4.4=py37h48bf904_1 -abess=0.4.4=py39hac2352c_1 -abess=0.4.4=py38h514daf8_0 abess=0.4.4=py39hac2352c_0 +abess=0.4.4=py38h514daf8_0 abess=0.4.4=py37h48bf904_0 diff --git a/crates/rattler_solve/tests/snapshots/sorting__test_ordering_python.snap b/crates/rattler_solve/tests/snapshots/sorting__test_ordering_python.snap index fca686525..16ab4128d 100644 --- a/crates/rattler_solve/tests/snapshots/sorting__test_ordering_python.snap +++ b/crates/rattler_solve/tests/snapshots/sorting__test_ordering_python.snap @@ -10,20 +10,20 @@ python=3.10.2=hc74c709_4_cpython python=3.10.2=h85951f9_4_cpython python=3.10.2=hc74c709_3_cpython python=3.10.2=h85951f9_3_cpython -python=3.10.2=h85951f9_2_cpython python=3.10.2=hc74c709_2_cpython -python=3.10.2=h85951f9_1_cpython +python=3.10.2=h85951f9_2_cpython python=3.10.2=hc74c709_1_cpython +python=3.10.2=h85951f9_1_cpython python=3.10.2=h543edf9_0_cpython python=3.10.2=h62f1059_0_cpython python=3.10.1=h543edf9_2_cpython python=3.10.1=h62f1059_2_cpython -python=3.10.1=h62f1059_1_cpython python=3.10.1=h543edf9_1_cpython +python=3.10.1=h62f1059_1_cpython python=3.10.1=h543edf9_0_cpython python=3.10.1=h62f1059_0_cpython -python=3.10.0=h62f1059_3_cpython python=3.10.0=h543edf9_3_cpython +python=3.10.0=h62f1059_3_cpython python=3.10.0=h543edf9_2_cpython python=3.10.0=h62f1059_2_cpython python=3.10.0=h543edf9_1_cpython diff --git a/crates/rattler_solve/tests/snapshots/sorting__test_ordering_pytorch.snap b/crates/rattler_solve/tests/snapshots/sorting__test_ordering_pytorch.snap index c4250a7fe..35d65274f 100644 --- a/crates/rattler_solve/tests/snapshots/sorting__test_ordering_pytorch.snap +++ b/crates/rattler_solve/tests/snapshots/sorting__test_ordering_pytorch.snap @@ -2,67 +2,67 @@ source: crates/rattler_solve/tests/sorting.rs expression: create_sorting_snapshot(spec) --- +pytorch=1.12.1=cuda112py310h51fe464_200 +pytorch=1.12.1=cuda111py310h385535d_200 +pytorch=1.12.1=cuda110py310hfdf97d1_200 +pytorch=1.12.1=cuda112py39ha0cca9b_200 +pytorch=1.12.1=cuda111py39h9f128c5_200 pytorch=1.12.1=cuda110py39h0a9da28_200 -pytorch=1.12.1=cuda110py37h0def887_200 +pytorch=1.12.1=cuda112py38habe9d5a_200 +pytorch=1.12.1=cuda111py38h2d04dd0_200 pytorch=1.12.1=cuda110py38h386aa8f_200 -pytorch=1.12.1=cuda102py37haad9b4f_200 -pytorch=1.12.1=cuda110py310hfdf97d1_200 -pytorch=1.12.1=cuda111py310h385535d_200 pytorch=1.12.1=cuda111py37hdb2541a_200 -pytorch=1.12.1=cuda112py310h51fe464_200 -pytorch=1.12.1=cuda112py38habe9d5a_200 +pytorch=1.12.1=cuda110py37h0def887_200 +pytorch=1.12.1=cuda102py310hdf4a2db_200 +pytorch=1.12.1=cuda102py39hbbcd3cb_200 pytorch=1.12.1=cuda102py38hfdb21e3_200 -pytorch=1.12.1=cuda111py38h2d04dd0_200 -pytorch=1.12.1=cuda111py39h9f128c5_200 -pytorch=1.12.1=cuda112py39ha0cca9b_200 pytorch=1.12.1=cuda112py37hfcfbd4c_200 -pytorch=1.12.1=cuda102py39hbbcd3cb_200 -pytorch=1.12.1=cuda102py310hdf4a2db_200 +pytorch=1.12.1=cuda102py37haad9b4f_200 pytorch=1.12.1=cpu_py310h75c9ab6_0 pytorch=1.12.1=cpu_py39h5d22d69_0 pytorch=1.12.1=cpu_py38h39c826d_0 pytorch=1.12.1=cpu_py37h14e09b7_0 -pytorch=1.12.0=cuda111py310h385535d_202 pytorch=1.12.0=cuda112py310h51fe464_202 -pytorch=1.12.0=cuda110py39h0a9da28_202 -pytorch=1.12.0=cuda111py38h2d04dd0_202 +pytorch=1.12.0=cuda111py310h385535d_202 +pytorch=1.12.0=cuda110py310hfdf97d1_202 pytorch=1.12.0=cuda112py39ha0cca9b_202 -pytorch=1.12.0=cuda102py39hbbcd3cb_202 pytorch=1.12.0=cuda111py39h9f128c5_202 -pytorch=1.12.0=cuda110py310hfdf97d1_202 -pytorch=1.12.0=cuda102py37haad9b4f_202 +pytorch=1.12.0=cuda110py39h0a9da28_202 +pytorch=1.12.0=cuda111py38h2d04dd0_202 +pytorch=1.12.0=cuda110py38h386aa8f_202 pytorch=1.12.0=cuda112py37hfcfbd4c_202 pytorch=1.12.0=cuda111py37hdb2541a_202 pytorch=1.12.0=cuda110py37h0def887_202 -pytorch=1.12.0=cuda110py38h386aa8f_202 pytorch=1.12.0=cuda102py310hdf4a2db_202 +pytorch=1.12.0=cuda102py39hbbcd3cb_202 pytorch=1.12.0=cuda112py38habe9d5a_202 pytorch=1.12.0=cuda102py38hfdb21e3_202 -pytorch=1.12.0=cuda111py310h385535d_200 +pytorch=1.12.0=cuda102py37haad9b4f_202 pytorch=1.12.0=cuda112py310h51fe464_200 -pytorch=1.12.0=cuda110py39h0a9da28_200 -pytorch=1.12.0=cuda111py38h2d04dd0_200 +pytorch=1.12.0=cuda111py310h385535d_200 +pytorch=1.12.0=cuda110py310hfdf97d1_200 pytorch=1.12.0=cuda112py39ha0cca9b_200 -pytorch=1.12.0=cuda102py39hbbcd3cb_200 pytorch=1.12.0=cuda111py39h9f128c5_200 -pytorch=1.12.0=cuda110py310hfdf97d1_200 -pytorch=1.12.0=cuda102py37haad9b4f_200 +pytorch=1.12.0=cuda110py39h0a9da28_200 +pytorch=1.12.0=cuda111py38h2d04dd0_200 +pytorch=1.12.0=cuda110py38h386aa8f_200 pytorch=1.12.0=cuda112py37hfcfbd4c_200 pytorch=1.12.0=cuda111py37hdb2541a_200 pytorch=1.12.0=cuda110py37h0def887_200 -pytorch=1.12.0=cuda110py38h386aa8f_200 pytorch=1.12.0=cuda102py310hdf4a2db_200 +pytorch=1.12.0=cuda102py39hbbcd3cb_200 pytorch=1.12.0=cuda112py38habe9d5a_200 pytorch=1.12.0=cuda102py38hfdb21e3_200 +pytorch=1.12.0=cuda102py37haad9b4f_200 +pytorch=1.12.0=cpu_py310h75c9ab6_2 pytorch=1.12.0=cpu_py39h5d22d69_2 pytorch=1.12.0=cpu_py38h39c826d_2 -pytorch=1.12.0=cpu_py310h75c9ab6_2 pytorch=1.12.0=cpu_py37h14e09b7_2 -pytorch=1.12.0=cpu_py38h39c826d_1 pytorch=1.12.0=cpu_py310h75c9ab6_1 -pytorch=1.12.0=cpu_py37h14e09b7_1 pytorch=1.12.0=cpu_py39h5d22d69_1 -pytorch=1.12.0=cpu_py37h14e09b7_0 -pytorch=1.12.0=cpu_py38h39c826d_0 +pytorch=1.12.0=cpu_py38h39c826d_1 +pytorch=1.12.0=cpu_py37h14e09b7_1 pytorch=1.12.0=cpu_py310h75c9ab6_0 pytorch=1.12.0=cpu_py39h5d22d69_0 +pytorch=1.12.0=cpu_py38h39c826d_0 +pytorch=1.12.0=cpu_py37h14e09b7_0 diff --git a/crates/rattler_solve/tests/sorting.rs b/crates/rattler_solve/tests/sorting.rs index edffe996a..842f33d72 100644 --- a/crates/rattler_solve/tests/sorting.rs +++ b/crates/rattler_solve/tests/sorting.rs @@ -5,14 +5,14 @@ use std::path::Path; use futures::FutureExt; use itertools::Itertools; use rattler_conda_types::{ - Channel, MatchSpec, Matches, PackageName, ParseStrictness::Lenient, RepoDataRecord, + Channel, MatchSpec, PackageName, ParseStrictness::Lenient, RepoDataRecord, }; use rattler_repodata_gateway::sparse::SparseRepoData; use rattler_solve::{resolvo::CondaDependencyProvider, ChannelPriority, SolveStrategy}; use resolvo::{Interner, SolverCache}; use rstest::*; -fn load_repodata(package_name: &PackageName) -> Vec { +fn load_repodata(package_name: &PackageName) -> Vec> { let channel_path = Path::new(env!("CARGO_MANIFEST_DIR")) .join("../..") .join("test-data") @@ -23,8 +23,8 @@ fn load_repodata(package_name: &PackageName) -> Vec { let sparse_repo_data = SparseRepoData::new(channel, "linux-64", repodata_json_path, None) .expect("failed to load sparse repodata"); - sparse_repo_data - .load_records(package_name) + + SparseRepoData::load_records_recursive(&[sparse_repo_data], [package_name.clone()], None) .expect("failed to load records") } @@ -33,12 +33,11 @@ fn create_sorting_snapshot(package_name: &str) -> String { let package_name = match_spec.name.clone().unwrap(); // Load repodata - let mut repodata = load_repodata(&package_name); - repodata.retain(|record| match_spec.matches(record)); + let repodata = load_repodata(&package_name); // Construct dependency provider let dependency_provider = CondaDependencyProvider::new( - [repodata.iter().collect()], + repodata.iter().map(|r| r.iter().collect()), &[], &[], &[],