Skip to content

Commit 2b23e1d

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

File tree

5 files changed

+68
-0
lines changed

5 files changed

+68
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,17 @@ jobs:
4646
shell: bash -l {0}
4747
run: |
4848
pip install -e .[test]
49+
- name: Install Pixi
50+
uses: prefix-dev/[email protected]
51+
with:
52+
run-install: false
53+
- name: Create environment with Pixi
54+
shell: bash -l {0}
55+
run: |
56+
cd ~
57+
pixi init pixi-test
58+
cd pixi-test
59+
pixi add python
4960
- name: Show environment information
5061
shell: bash -l {0}
5162
run: |

.github/workflows/linux-tests.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,17 @@ jobs:
5353
- name: Install Package
5454
shell: bash -l {0}
5555
run: pip install -e .
56+
- name: Install Pixi
57+
uses: prefix-dev/[email protected]
58+
with:
59+
run-install: false
60+
- name: Create environment with Pixi
61+
shell: bash -l {0}
62+
run: |
63+
cd ~
64+
pixi init pixi-test
65+
cd pixi-test
66+
pixi add python
5667
- name: Show environment information
5768
shell: bash -l {0}
5869
run: |

.github/workflows/macos-tests.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@ jobs:
4949
- name: Install Package
5050
shell: bash -l {0}
5151
run: pip install -e .
52+
- name: Install Pixi
53+
uses: prefix-dev/[email protected]
54+
with:
55+
run-install: false
56+
- name: Create environment with Pixi
57+
shell: bash -l {0}
58+
run: |
59+
cd ~
60+
pixi init pixi-test
61+
cd pixi-test
62+
pixi add python
5263
- name: Show environment information
5364
shell: bash -l {0}
5465
run: |

.github/workflows/windows-tests.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@ jobs:
4949
- name: Install Package
5050
shell: bash -l {0}
5151
run: pip install -e .
52+
- name: Install Pixi
53+
uses: prefix-dev/[email protected]
54+
with:
55+
run-install: false
56+
- name: Create environment with Pixi
57+
shell: bash -l {0}
58+
run: |
59+
cd ~
60+
pixi init pixi-test
61+
cd pixi-test
62+
pixi add python
5263
- name: Show environment information
5364
shell: bash -l {0}
5465
run: |

spyder_kernels/utils/tests/test_pythonenv.py

Lines changed: 24 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,26 @@ def test_get_env_dir():
6265
assert output == "foobar"
6366

6467

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

0 commit comments

Comments
 (0)