Skip to content

Commit c311e64

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

File tree

5 files changed

+55
-0
lines changed

5 files changed

+55
-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/bin/pixi init pixi-test
55+
cd pixi-test
56+
~/.pixi/bin/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/bin/pixi init pixi-test
62+
cd pixi-test
63+
~/.pixi/bin/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/bin/pixi init pixi-test
58+
cd pixi-test
59+
~/.pixi/bin/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/bin/pixi init pixi-test
58+
cd pixi-test
59+
~/.pixi/bin/pixi add python
5260
- name: Show environment information
5361
shell: bash -l {0}
5462
run: |

spyder_kernels/utils/tests/test_pythonenv.py

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

6467

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

0 commit comments

Comments
 (0)