Skip to content

Commit 7a54da1

Browse files
authored
fix: set pixi cache dir when building cmake extensions (#4567)
1 parent e032973 commit 7a54da1

File tree

2 files changed

+47
-6
lines changed

2 files changed

+47
-6
lines changed

crates/pixi/tests/integration_rust/install_tests.rs

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -805,7 +805,17 @@ setup(
805805
.contains(&"my-pkg".parse().unwrap());
806806

807807
assert!(has_pkg, "my-pkg is not in no-build-isolation list");
808-
pixi.install().await.expect("cannot install project");
808+
809+
let tmp_dir = tempdir().unwrap();
810+
let tmp_dir_path = tmp_dir.path();
811+
812+
temp_env::async_with_vars(
813+
[("PIXI_CACHE_DIR", Some(tmp_dir_path.to_str().unwrap()))],
814+
async {
815+
pixi.install().await.expect("cannot install project");
816+
},
817+
)
818+
.await;
809819
}
810820

811821
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
@@ -917,9 +927,19 @@ setup(
917927
// 2. PyPI packages with build isolation (package-tdjager) - batch
918928
// 3. PyPI packages without build isolation (package-b) - one by one
919929
// The key test: package-b should be able to import package-tdjager during its build
920-
pixi.install()
921-
.await
922-
.expect("cannot install project with no-build-isolation dependencies");
930+
931+
let tmp_dir = tempdir().unwrap();
932+
let tmp_dir_path = tmp_dir.path();
933+
934+
temp_env::async_with_vars(
935+
[("PIXI_CACHE_DIR", Some(tmp_dir_path.to_str().unwrap()))],
936+
async {
937+
pixi.install()
938+
.await
939+
.expect("cannot install project with no-build-isolation dependencies");
940+
},
941+
)
942+
.await;
923943
}
924944

925945
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
@@ -953,7 +973,17 @@ async fn test_setuptools_override_failure() {
953973
platform = Platform::current()
954974
);
955975
let pixi = PixiControl::from_manifest(&manifest).expect("cannot instantiate pixi project");
956-
pixi.install().await.expect("cannot install project");
976+
977+
let tmp_dir = tempdir().unwrap();
978+
let tmp_dir_path = tmp_dir.path();
979+
980+
temp_env::async_with_vars(
981+
[("PIXI_CACHE_DIR", Some(tmp_dir_path.to_str().unwrap()))],
982+
async {
983+
pixi.install().await.expect("cannot install project");
984+
},
985+
)
986+
.await;
957987
}
958988

959989
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]

crates/pixi/tests/integration_rust/pypi_tests.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use std::io::Write;
22

33
use rattler_conda_types::Platform;
4+
use tempfile::tempdir;
45
use typed_path::Utf8TypedPath;
56

67
use crate::common::pypi_index::{Database as PyPIDatabase, PyPIPackage};
@@ -385,7 +386,17 @@ async fn test_indexes_are_passed_when_solving_build_pypi_dependencies() {
385386
let lock_file = pixi.update_lock_file().await.unwrap();
386387

387388
// verify that the pypi-build-index can be installed when solved the build dependencies
388-
pixi.install().await.unwrap();
389+
390+
let tmp_dir = tempdir().unwrap();
391+
let tmp_dir_path = tmp_dir.path();
392+
393+
temp_env::async_with_vars(
394+
[("PIXI_CACHE_DIR", Some(tmp_dir_path.to_str().unwrap()))],
395+
async {
396+
pixi.install().await.unwrap();
397+
},
398+
)
399+
.await;
389400

390401
let mut local_pypi_index = simple.index_path().display().to_string();
391402

0 commit comments

Comments
 (0)