Skip to content

Commit ea17769

Browse files
committed
Add test that path is preserved
1 parent 2f9d8f8 commit ea17769

16 files changed

+166
-0
lines changed
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"info": {
3+
"subdir": "linux-64"
4+
},
5+
"packages": {},
6+
"packages.conda": {
7+
"dummy-trampoline-path-0.1.0-hb0f4dca_0.conda": {
8+
"arch": "x86_64",
9+
"build": "hb0f4dca_0",
10+
"build_number": 0,
11+
"depends": [],
12+
"md5": "72c665e2d984d359290d5f1959fedd04",
13+
"name": "dummy-trampoline-path",
14+
"platform": "linux",
15+
"sha256": "068ad10a766de3df094c60b6b1a0f3051e738dc197964b58094d3e6981ef80de",
16+
"size": 1381,
17+
"subdir": "linux-64",
18+
"timestamp": 1732292078964,
19+
"version": "0.1.0"
20+
}
21+
},
22+
"repodata_version": 2
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"info": {
3+
"subdir": "noarch"
4+
},
5+
"packages": {},
6+
"packages.conda": {},
7+
"repodata_version": 2
8+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"info": {
3+
"subdir": "osx-64"
4+
},
5+
"packages": {},
6+
"packages.conda": {
7+
"dummy-trampoline-path-0.1.0-h0dc7051_0.conda": {
8+
"arch": "x86_64",
9+
"build": "h0dc7051_0",
10+
"build_number": 0,
11+
"depends": [],
12+
"md5": "92f5ed46e9a430d6e97dae052ac7d735",
13+
"name": "dummy-trampoline-path",
14+
"platform": "osx",
15+
"sha256": "3d73a352067e6b64e3da54e7eef20d3906096ec05bc8c191da11abcb39b5a16b",
16+
"size": 1373,
17+
"subdir": "osx-64",
18+
"timestamp": 1732292079037,
19+
"version": "0.1.0"
20+
}
21+
},
22+
"repodata_version": 2
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"info": {
3+
"subdir": "osx-arm64"
4+
},
5+
"packages": {},
6+
"packages.conda": {
7+
"dummy-trampoline-path-0.1.0-h60d57d3_0.conda": {
8+
"arch": "arm64",
9+
"build": "h60d57d3_0",
10+
"build_number": 0,
11+
"depends": [],
12+
"md5": "0f918d9648524ba9d788805239c91a9f",
13+
"name": "dummy-trampoline-path",
14+
"platform": "osx",
15+
"sha256": "8ffa63de7f3ff1436e1b95ff19b7cb8b316d1de8855fa3b7cccfd057af84ec27",
16+
"size": 1374,
17+
"subdir": "osx-arm64",
18+
"timestamp": 1732292079,
19+
"version": "0.1.0"
20+
}
21+
},
22+
"repodata_version": 2
23+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"info": {
3+
"subdir": "win-64"
4+
},
5+
"packages": {},
6+
"packages.conda": {
7+
"dummy-trampoline-path-0.1.0-h9490d1a_0.conda": {
8+
"arch": "x86_64",
9+
"build": "h9490d1a_0",
10+
"build_number": 0,
11+
"depends": [],
12+
"md5": "a00d5b897c3e64e4d41b1af066161ebd",
13+
"name": "dummy-trampoline-path",
14+
"platform": "win",
15+
"sha256": "5514fbf781e0f1e953ae5031bd17ed693ec945c675bd809b5b42868b8dd3205e",
16+
"size": 1375,
17+
"subdir": "win-64",
18+
"timestamp": 1732292078932,
19+
"version": "0.1.0"
20+
}
21+
},
22+
"repodata_version": 2
23+
}

tests/data/channels/mappings.toml

+1
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@
66
"non_self_expose_channel_2.yaml" = "non_self_expose_channel_2"
77
"trampoline/trampoline_1.yaml" = "trampoline_1"
88
"trampoline/trampoline_2.yaml" = "trampoline_2"
9+
"trampoline/trampoline_path.yaml" = "trampoline_path_channel"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@echo off
2+
echo %PATH%
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#!/bin/bash
2+
3+
echo $PATH
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
recipe:
2+
name: trampoline
3+
version: 1.0.0
4+
5+
outputs:
6+
- package:
7+
name: dummy-trampoline-path
8+
version: 0.1.0
9+
source:
10+
path: .
11+
12+
build:
13+
script:
14+
- mkdir -p $PREFIX/bin
15+
- if: win
16+
then:
17+
- mkdir -p $PREFIX/etc/conda/activate.d
18+
- echo "set PATH=%PATH%;/test/path" > $PREFIX/etc/conda/activate.d/activate-trampoline.bat
19+
- mv print_path.bat $PREFIX/bin/dummy-trampoline-path.bat
20+
else:
21+
- mkdir -p $PREFIX/etc/conda/activate.d
22+
- echo "export PATH=/test/path:\$PATH" > $PREFIX/etc/conda/activate.d/activate-trampoline.sh
23+
- mv print_path.sh $PREFIX/bin/dummy-trampoline-path
24+
- chmod +x $PREFIX/bin/dummy-trampoline-path

tests/integration_python/global/conftest.py

+5
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,8 @@ def trampoline_channel_1(channels: Path) -> str:
1010
@pytest.fixture
1111
def trampoline_channel_2(channels: Path) -> str:
1212
return channels.joinpath("trampoline_2").as_uri()
13+
14+
15+
@pytest.fixture
16+
def trampoline_path_channel(channels: Path) -> str:
17+
return channels.joinpath("trampoline_path_channel").as_uri()

tests/integration_python/global/test_trampoline.py

+31
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import pathlib
33
from pathlib import Path
44
import platform
5+
import os
56

67
from ..common import verify_cli_command, exec_extension, is_binary
78

@@ -227,3 +228,33 @@ def test_trampoline_migrate_with_newer_trampoline(
227228
stderr_contains="Environment dummy-trampoline was already up-to-date",
228229
stderr_excludes="Updated executable dummy-trampoline of environment dummy-trampoline",
229230
)
231+
232+
233+
def test_trampoline_extends_path(pixi: Path, tmp_path: Path, trampoline_path_channel: str) -> None:
234+
env = {"PIXI_HOME": str(tmp_path)}
235+
236+
dummy_trampoline_path = tmp_path / "bin" / exec_extension("dummy-trampoline-path")
237+
238+
verify_cli_command(
239+
[
240+
pixi,
241+
"global",
242+
"install",
243+
"--channel",
244+
trampoline_path_channel,
245+
"dummy-trampoline-path",
246+
],
247+
env=env,
248+
)
249+
250+
verify_cli_command(
251+
[dummy_trampoline_path],
252+
stdout_contains=["/test/path", os.environ["PATH"]],
253+
)
254+
255+
os.environ["PATH"] = "/another/test/path" + os.pathsep + os.environ["PATH"]
256+
257+
verify_cli_command(
258+
[dummy_trampoline_path],
259+
stdout_contains=["/another/test/path", "/test/path"],
260+
)

0 commit comments

Comments
 (0)