Skip to content

Commit 68c71bc

Browse files
authored
test: improved two tests to not use big packages or slow repodata (#4959)
1 parent e845d0a commit 68c71bc

File tree

4 files changed

+40
-19
lines changed

4 files changed

+40
-19
lines changed

crates/pixi/tests/integration_rust/add_tests.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,19 +89,19 @@ async fn add_with_channel() {
8989

9090
let pixi = PixiControl::new().unwrap();
9191

92-
pixi.init().no_fast_prefix_overwrite(true).await.unwrap();
92+
pixi.init().await.unwrap();
9393

94-
pixi.add("https://prefix.dev/conda-forge::py_rattler")
94+
pixi.add("https://prefix.dev/conda-forge::_openmp_mutex")
9595
.with_install(false)
9696
.with_frozen(true)
9797
.await
9898
.unwrap();
9999

100100
pixi.project_channel_add()
101-
.with_channel("https://conda.anaconda.org/conda-forge")
101+
.with_channel("https://prefix.dev/robostack-kilted")
102102
.await
103103
.unwrap();
104-
pixi.add("https://conda.anaconda.org/conda-forge::_r-mutex")
104+
pixi.add("https://prefix.dev/robostack-kilted::ros2-distro-mutex")
105105
.with_install(false)
106106
.await
107107
.unwrap();
@@ -113,17 +113,17 @@ async fn add_with_channel() {
113113
.into_specs();
114114

115115
let (name, spec) = specs.next().unwrap();
116-
assert_eq!(name, PackageName::try_from("py_rattler").unwrap());
116+
assert_eq!(name, PackageName::try_from("_openmp_mutex").unwrap());
117117
assert_eq!(
118118
spec.into_detailed().unwrap().channel.unwrap().as_str(),
119119
"https://prefix.dev/conda-forge"
120120
);
121121

122122
let (name, spec) = specs.next().unwrap();
123-
assert_eq!(name, PackageName::try_from("_r-mutex").unwrap());
123+
assert_eq!(name, PackageName::try_from("ros2-distro-mutex").unwrap());
124124
assert_eq!(
125125
spec.into_detailed().unwrap().channel.unwrap().as_str(),
126-
"conda-forge"
126+
"https://prefix.dev/robostack-kilted"
127127
);
128128
}
129129

crates/pixi/tests/integration_rust/install_tests.rs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -362,21 +362,18 @@ async fn install_frozen_skip() {
362362
setup_tracing();
363363

364364
// Create a project with a local python dependency 'no-build-editable'
365-
// and a local conda dependency 'python_rich'
365+
// and a local conda dependency 'simple-package'
366366
let current_platform = Platform::current();
367367
let manifest = format!(
368368
r#"
369369
[workspace]
370-
channels = ["conda-forge"]
371-
description = "Add a short description here"
372-
name = "pyproject"
370+
channels = ["https://prefix.dev/conda-forge"]
373371
platforms = ["{current_platform}"]
374372
preview = ["pixi-build"]
375-
version = "0.1.0"
376373
377374
[dependencies]
378375
python = "*"
379-
python_rich = {{ path = "./python" }}
376+
simple-package = {{ path = "./simple-package" }}
380377
381378
[pypi-dependencies]
382379
no-build-editable = {{ path = "./no-build-editable" }}
@@ -388,7 +385,7 @@ async fn install_frozen_skip() {
388385
let workspace_root = PathBuf::from(env!("CARGO_WORKSPACE_DIR"));
389386

390387
fs_extra::dir::copy(
391-
workspace_root.join("docs/source_files/pixi_workspaces/pixi_build/python"),
388+
workspace_root.join("tests/data/pixi-build/simple-package"),
392389
pixi.workspace_path(),
393390
&fs_extra::dir::CopyOptions::new(),
394391
)
@@ -403,10 +400,10 @@ async fn install_frozen_skip() {
403400

404401
pixi.update_lock_file().await.unwrap();
405402

406-
// Check that neither 'python_rich' nor 'no-build-editable' are installed when skipped
403+
// Check that neither 'simple-package' nor 'no-build-editable' are installed when skipped
407404
pixi.install()
408405
.with_frozen()
409-
.with_skipped(vec!["no-build-editable".into(), "python_rich".into()])
406+
.with_skipped(vec!["no-build-editable".into(), "simple-package".into()])
410407
.await
411408
.unwrap();
412409

@@ -415,13 +412,13 @@ async fn install_frozen_skip() {
415412
let env = create_uv_environment(&prefix_path, &cache);
416413

417414
assert!(!is_pypi_package_installed(&env, "no-build-editable"));
418-
assert!(!is_conda_package_installed(&prefix_path, "python_rich").await);
415+
assert!(!is_conda_package_installed(&prefix_path, "simple-package").await);
419416

420-
// Check that 'no-build-editable' and 'python_rich' are installed after a followup normal install
417+
// Check that 'no-build-editable' and 'simple-package' are installed after a followup normal install
421418
pixi.install().with_frozen().await.unwrap();
422419

423420
assert!(is_pypi_package_installed(&env, "no-build-editable"));
424-
assert!(is_conda_package_installed(&prefix_path, "python_rich").await);
421+
assert!(is_conda_package_installed(&prefix_path, "simple-package").await);
425422
}
426423

427424
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[workspace]
2+
channels = ["https://prefix.dev/conda-forge"]
3+
preview = ["pixi-build"]
4+
5+
[package.build.backend]
6+
name = "pixi-build-rattler-build"
7+
version = "*"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package:
2+
name: simple-package
3+
version: 0.1.0
4+
5+
build:
6+
number: 0
7+
script:
8+
- if: win
9+
then:
10+
- if not exist "%PREFIX%\bin" mkdir "%PREFIX%\bin"
11+
- echo @echo off > %PREFIX%\bin\simple-package.bat
12+
- echo echo hello from simple-package >> %PREFIX%\bin\simple-package.bat
13+
else:
14+
- mkdir -p $PREFIX/bin
15+
- echo "#!/usr/bin/env bash" > $PREFIX/bin/simple-package
16+
- echo "echo hello from simple-package" >> $PREFIX/bin/simple-package
17+
- chmod +x $PREFIX/bin/simple-package

0 commit comments

Comments
 (0)