Skip to content

Commit e465bca

Browse files
committed
Add test for get_pixi_manifest_path_and_env_name
1 parent 4a1c345 commit e465bca

File tree

5 files changed

+54
-0
lines changed

5 files changed

+54
-0
lines changed

.github/workflows/linux-pip-tests.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,14 @@ jobs:
4646
shell: bash -l {0}
4747
run: |
4848
pip install -e .[test]
49+
- name: Create environment with Pixi
50+
shell: bash -l {0}
51+
run: |
52+
curl -fsSL https://pixi.sh/install.sh | sh
53+
cd ~
54+
pixi init pixi-test
55+
cd pixi-test
56+
pixi add python
4957
- name: Show environment information
5058
shell: bash -l {0}
5159
run: |

.github/workflows/linux-tests.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ jobs:
5353
- name: Install Package
5454
shell: bash -l {0}
5555
run: pip install -e .
56+
- name: Create environment with Pixi
57+
shell: bash -l {0}
58+
run: |
59+
curl -fsSL https://pixi.sh/install.sh | sh
60+
cd ~
61+
pixi init pixi-test
62+
cd pixi-test
63+
pixi add python
5664
- name: Show environment information
5765
shell: bash -l {0}
5866
run: |

.github/workflows/macos-tests.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ jobs:
4949
- name: Install Package
5050
shell: bash -l {0}
5151
run: pip install -e .
52+
- name: Create environment with Pixi
53+
shell: bash -l {0}
54+
run: |
55+
curl -fsSL https://pixi.sh/install.sh | sh
56+
cd ~
57+
pixi init pixi-test
58+
cd pixi-test
59+
pixi add python
5260
- name: Show environment information
5361
shell: bash -l {0}
5462
run: |

.github/workflows/windows-tests.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,14 @@ jobs:
4949
- name: Install Package
5050
shell: bash -l {0}
5151
run: pip install -e .
52+
- name: Create environment with Pixi
53+
shell: bash -l {0}
54+
run: |
55+
curl -fsSL https://pixi.sh/install.sh | sh
56+
cd ~
57+
pixi init pixi-test
58+
cd pixi-test
59+
pixi add python
5260
- name: Show environment information
5361
shell: bash -l {0}
5462
run: |

spyder_kernels/utils/tests/test_pythonenv.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212

1313
# Standard library imports
1414
import os
15+
from pathlib import Path
16+
import shutil
1517

1618
# Third-party imports
1719
import pytest
@@ -21,6 +23,7 @@
2123
add_quotes,
2224
get_conda_env_path,
2325
get_env_dir,
26+
get_pixi_manifest_path_and_env_name,
2427
)
2528

2629

@@ -62,5 +65,24 @@ def test_get_env_dir():
6265
assert output == "foobar"
6366

6467

68+
@pytest.mark.skipif(
69+
not (shutil.which("pixi") and os.environ.get("CI")),
70+
reason="Only works with Pixi on CIs"
71+
)
72+
def get_pixi_info():
73+
home_dir = Path(os.environ["HOME"])
74+
pixi_env_dir = home_dir / "pixi-test" / ".pixi" / "envs" / "default"
75+
76+
pixi_env_info = get_pixi_manifest_path_and_env_name(
77+
str(pixi_env_dir / "python.exe")
78+
if os.name == "nt"
79+
else str(pixi_env_dir / "bin" / "python")
80+
)
81+
82+
assert pixi_env_info == (
83+
str(home_dir / "pixi-test" / "pixi.toml"), "default"
84+
)
85+
86+
6587
if __name__ == "__main__":
6688
pytest.main()

0 commit comments

Comments
 (0)