diff --git a/crates/rattler_conda_types/src/repo_data/snapshots/rattler_conda_types__repo_data__test__base_url_packages.snap b/crates/rattler_conda_types/src/repo_data/snapshots/rattler_conda_types__repo_data__test__base_url_packages.snap index 4aa817cf6..83b625117 100644 --- a/crates/rattler_conda_types/src/repo_data/snapshots/rattler_conda_types__repo_data__test__base_url_packages.snap +++ b/crates/rattler_conda_types/src/repo_data/snapshots/rattler_conda_types__repo_data__test__base_url_packages.snap @@ -1,11 +1,18 @@ --- source: crates/rattler_conda_types/src/repo_data/mod.rs -assertion_line: 493 expression: file_urls --- -- channels/dummy/linux-64/foo-3.0.2-py36h1af98f8_1.tar.bz2 +- "channels/dummy/linux-64/baz-2.0-unix_py36h1af98f8_2\u0000.tar.bz2" - "channels/dummy/linux-64/baz-1.0-unix_py36h1af98f8_2\u0000.tar.bz2" -- channels/dummy/linux-64/foo-4.0.2-py36h1af98f8_2.tar.bz2 +- channels/dummy/linux-64/bors-2.1-bla_1.tar.bz2 - channels/dummy/linux-64/bar-1.0-unix_py36h1af98f8_2.tar.bz2 +- channels/dummy/linux-64/bors-1.0-bla_1.tar.bz2 - channels/dummy/linux-64/foo-3.0.2-py36h1af98f8_1.conda +- channels/dummy/linux-64/foo-3.0.2-py36h1af98f8_1.tar.bz2 +- channels/dummy/linux-64/bors-1.1-bla_1.tar.bz2 +- channels/dummy/linux-64/foo-4.0.2-py36h1af98f8_2.tar.bz2 +- channels/dummy/linux-64/bors-2.0-bla_1.tar.bz2 +- channels/dummy/linux-64/foobar-2.0-bla_1.tar.bz2 +- channels/dummy/linux-64/foobar-2.1-bla_1.tar.bz2 +- channels/dummy/linux-64/bors-1.2.1-bla_1.tar.bz2 diff --git a/crates/rattler_conda_types/src/repo_data/snapshots/rattler_conda_types__repo_data__test__serialize_packages-2.snap b/crates/rattler_conda_types/src/repo_data/snapshots/rattler_conda_types__repo_data__test__serialize_packages-2.snap index 017208b48..e453ab24c 100644 --- a/crates/rattler_conda_types/src/repo_data/snapshots/rattler_conda_types__repo_data__test__serialize_packages-2.snap +++ b/crates/rattler_conda_types/src/repo_data/snapshots/rattler_conda_types__repo_data__test__serialize_packages-2.snap @@ -34,13 +34,97 @@ expression: json "license": "MIT", "license_family": "MIT", "md5": "bc13aa58e2092bcb0b97c561373d3905", - "name": "bar", + "name": "baz", "sha256": "97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a", "size": 414494, "subdir": "linux-64", "timestamp": 1605110689658, "version": "1.2.3" }, + "baz-2.0-unix_py36h1af98f8_2\u0000.tar.bz2": { + "build": "unix_py36h1af98f8_2\u0000", + "build_number": 1, + "depends": [], + "license": "MIT", + "license_family": "MIT", + "md5": "bc13aa58e2092bcb0b97c561373d3905", + "name": "baz", + "sha256": "97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a", + "size": 414494, + "subdir": "linux-64", + "timestamp": 1605110689658, + "version": "2.0" + }, + "bors-1.0-bla_1.tar.bz2": { + "build": "bla_1", + "build_number": 1, + "depends": [], + "license": "MIT", + "license_family": "MIT", + "md5": "bc13aa58e2092bcb0b97c561373d3905", + "name": "bors", + "sha256": "97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a", + "size": 414494, + "subdir": "linux-64", + "timestamp": 1605110689658, + "version": "1.0" + }, + "bors-1.1-bla_1.tar.bz2": { + "build": "bla_1", + "build_number": 1, + "depends": [], + "license": "MIT", + "license_family": "MIT", + "md5": "bc13aa58e2092bcb0b97c561373d3905", + "name": "bors", + "sha256": "97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a", + "size": 414494, + "subdir": "linux-64", + "timestamp": 1605110689658, + "version": "1.1" + }, + "bors-1.2.1-bla_1.tar.bz2": { + "build": "bla_1", + "build_number": 1, + "depends": [], + "license": "MIT", + "license_family": "MIT", + "md5": "bc13aa58e2092bcb0b97c561373d3905", + "name": "bors", + "sha256": "97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a", + "size": 414494, + "subdir": "linux-64", + "timestamp": 1605110689658, + "version": "1.2.1" + }, + "bors-2.0-bla_1.tar.bz2": { + "build": "bla_1", + "build_number": 1, + "depends": [], + "license": "MIT", + "license_family": "MIT", + "md5": "bc13aa58e2092bcb0b97c561373d3905", + "name": "bors", + "sha256": "97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a", + "size": 414494, + "subdir": "linux-64", + "timestamp": 1605110689658, + "version": "2.0" + }, + "bors-2.1-bla_1.tar.bz2": { + "build": "bla_1", + "build_number": 1, + "depends": [], + "license": "MIT", + "license_family": "MIT", + "md5": "bc13aa58e2092bcb0b97c561373d3905", + "name": "bors", + "sha256": "97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a", + "size": 414494, + "subdir": "linux-64", + "timestamp": 1605110689658, + "version": "2.1" + }, "foo-3.0.2-py36h1af98f8_1.conda": { "build": "py36h1af98f8_1", "build_number": 1, @@ -82,6 +166,38 @@ expression: json "subdir": "linux-64", "timestamp": 1605110689658, "version": "4.0.2" + }, + "foobar-2.0-bla_1.tar.bz2": { + "build": "bla_1", + "build_number": 1, + "depends": [ + "bors <2.0" + ], + "license": "MIT", + "license_family": "MIT", + "md5": "bc13aa58e2092bcb0b97c561373d3905", + "name": "foobar", + "sha256": "97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a", + "size": 414494, + "subdir": "linux-64", + "timestamp": 1605110689658, + "version": "2.0" + }, + "foobar-2.1-bla_1.tar.bz2": { + "build": "bla_1", + "build_number": 1, + "depends": [ + "bors <2.0" + ], + "license": "MIT", + "license_family": "MIT", + "md5": "bc13aa58e2092bcb0b97c561373d3905", + "name": "foobar", + "sha256": "97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a", + "size": 414494, + "subdir": "linux-64", + "timestamp": 1605110689658, + "version": "2.1" } }, "packages.conda": {}, diff --git a/crates/rattler_conda_types/src/repo_data/snapshots/rattler_conda_types__repo_data__test__serialize_packages.snap b/crates/rattler_conda_types/src/repo_data/snapshots/rattler_conda_types__repo_data__test__serialize_packages.snap index 13a13bd4d..a567113a3 100644 --- a/crates/rattler_conda_types/src/repo_data/snapshots/rattler_conda_types__repo_data__test__serialize_packages.snap +++ b/crates/rattler_conda_types/src/repo_data/snapshots/rattler_conda_types__repo_data__test__serialize_packages.snap @@ -29,12 +29,90 @@ packages: license: MIT license_family: MIT md5: bc13aa58e2092bcb0b97c561373d3905 - name: bar + name: baz sha256: 97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a size: 414494 subdir: linux-64 timestamp: 1605110689658 version: 1.2.3 + "baz-2.0-unix_py36h1af98f8_2\u0000.tar.bz2": + build: "unix_py36h1af98f8_2\u0000" + build_number: 1 + depends: [] + license: MIT + license_family: MIT + md5: bc13aa58e2092bcb0b97c561373d3905 + name: baz + sha256: 97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a + size: 414494 + subdir: linux-64 + timestamp: 1605110689658 + version: "2.0" + bors-1.0-bla_1.tar.bz2: + build: bla_1 + build_number: 1 + depends: [] + license: MIT + license_family: MIT + md5: bc13aa58e2092bcb0b97c561373d3905 + name: bors + sha256: 97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a + size: 414494 + subdir: linux-64 + timestamp: 1605110689658 + version: "1.0" + bors-1.1-bla_1.tar.bz2: + build: bla_1 + build_number: 1 + depends: [] + license: MIT + license_family: MIT + md5: bc13aa58e2092bcb0b97c561373d3905 + name: bors + sha256: 97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a + size: 414494 + subdir: linux-64 + timestamp: 1605110689658 + version: "1.1" + bors-1.2.1-bla_1.tar.bz2: + build: bla_1 + build_number: 1 + depends: [] + license: MIT + license_family: MIT + md5: bc13aa58e2092bcb0b97c561373d3905 + name: bors + sha256: 97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a + size: 414494 + subdir: linux-64 + timestamp: 1605110689658 + version: 1.2.1 + bors-2.0-bla_1.tar.bz2: + build: bla_1 + build_number: 1 + depends: [] + license: MIT + license_family: MIT + md5: bc13aa58e2092bcb0b97c561373d3905 + name: bors + sha256: 97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a + size: 414494 + subdir: linux-64 + timestamp: 1605110689658 + version: "2.0" + bors-2.1-bla_1.tar.bz2: + build: bla_1 + build_number: 1 + depends: [] + license: MIT + license_family: MIT + md5: bc13aa58e2092bcb0b97c561373d3905 + name: bors + sha256: 97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a + size: 414494 + subdir: linux-64 + timestamp: 1605110689658 + version: "2.1" foo-3.0.2-py36h1af98f8_1.conda: build: py36h1af98f8_1 build_number: 1 @@ -74,6 +152,34 @@ packages: subdir: linux-64 timestamp: 1605110689658 version: 4.0.2 + foobar-2.0-bla_1.tar.bz2: + build: bla_1 + build_number: 1 + depends: + - bors <2.0 + license: MIT + license_family: MIT + md5: bc13aa58e2092bcb0b97c561373d3905 + name: foobar + sha256: 97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a + size: 414494 + subdir: linux-64 + timestamp: 1605110689658 + version: "2.0" + foobar-2.1-bla_1.tar.bz2: + build: bla_1 + build_number: 1 + depends: + - bors <2.0 + license: MIT + license_family: MIT + md5: bc13aa58e2092bcb0b97c561373d3905 + name: foobar + sha256: 97ec377d2ad83dfef1194b7aa31b0c9076194e10d995a6e696c9d07dd782b14a + size: 414494 + subdir: linux-64 + timestamp: 1605110689658 + version: "2.1" packages.conda: {} repodata_version: 2 diff --git a/crates/rattler_solve/tests/backends.rs b/crates/rattler_solve/tests/backends.rs index 67b486d60..4d5b1beca 100644 --- a/crates/rattler_solve/tests/backends.rs +++ b/crates/rattler_solve/tests/backends.rs @@ -187,6 +187,21 @@ macro_rules! solver_backend_tests { insta::assert_yaml_snapshot!(solve_real_world::<$T>(vec!["python=3.9"])); } + #[test] + fn test_solve_with_error() { + let result = solve::<$T>( + dummy_channel_json_path(), + Vec::new(), + Vec::new(), + &["foobar >=2", "bors >= 2"], + ); + + assert!(result.is_err()); + + let err = result.err().unwrap(); + insta::assert_debug_snapshot!(err); + } + #[test] fn test_solve_dummy_repo_install_non_existent() { let result = solve::<$T>( diff --git a/crates/rattler_solve/tests/snapshots/backends__libsolv_c__solve_with_error.snap b/crates/rattler_solve/tests/snapshots/backends__libsolv_c__solve_with_error.snap new file mode 100644 index 000000000..4d7e2b18f --- /dev/null +++ b/crates/rattler_solve/tests/snapshots/backends__libsolv_c__solve_with_error.snap @@ -0,0 +1,9 @@ +--- +source: crates/rattler_solve/tests/backends.rs +expression: err +--- +Unsolvable( + [ + "package foobar-2.0-bla_1 requires bors <2.0, but none of the providers can be installed", + ], +) diff --git a/crates/rattler_solve/tests/snapshots/backends__libsolv_rs__solve_with_error.snap b/crates/rattler_solve/tests/snapshots/backends__libsolv_rs__solve_with_error.snap new file mode 100644 index 000000000..7fab49982 --- /dev/null +++ b/crates/rattler_solve/tests/snapshots/backends__libsolv_rs__solve_with_error.snap @@ -0,0 +1,9 @@ +--- +source: crates/rattler_solve/tests/backends.rs +expression: err +--- +Unsolvable( + [ + "The following packages are incompatible\n|-- foobar >=2 can be installed with any of the following options:\n |-- foobar 2.0 | 2.1 would require\n |-- bors <2.0, which can be installed with any of the following options:\n |-- bors 1.2.1\n|-- bors >=2 cannot be installed because there are no viable options:\n |-- bors 2.1, which conflicts with the versions reported above.\n |-- bors 2.0, which conflicts with the versions reported above.\n", + ], +) diff --git a/test-data/channels/dummy/linux-64/repodata.json b/test-data/channels/dummy/linux-64/repodata.json index 4a4acf92d..9e6b4d306 100644 --- a/test-data/channels/dummy/linux-64/repodata.json +++ b/test-data/channels/dummy/linux-64/repodata.json @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:659258cfd03f77f6af79d51d882dfdbafd68f9fb6fde2475a45f3452f7389345 -size 2449 +oid sha256:adf739ba7312a1c7a179b7e9017e8b15e66a1dc08e4151ecca0c88a4f5d7131c +size 6004