Skip to content

Commit fc6f36a

Browse files
authored
fix flaky pixi toml query (#74)
1 parent 3ce2888 commit fc6f36a

3 files changed

Lines changed: 12 additions & 23 deletions

File tree

.github/workflows/pr-ci.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,9 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
os: [ubuntu-latest, windows-latest, macos-latest]
15-
python-version: ["3.12"]
1615
steps:
17-
- uses: actions/checkout@v4
16+
- uses: actions/checkout@v7
1817
- name: setup-pixi
19-
uses: prefix-dev/setup-pixi@v0.8.3
18+
uses: prefix-dev/setup-pixi@v0.9.6
2019
- name: Run tests
2120
run: pixi run test

template/.github/workflows/pr-ci.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
os: [ubuntu-latest, windows-latest, macos-latest]
16-
python-version: ["3.12"]
1716
steps:
18-
- uses: actions/checkout@v4
17+
- uses: actions/checkout@v7
1918
- name: Setup pixi
20-
uses: prefix-dev/setup-pixi@v0.8.3
19+
uses: prefix-dev/setup-pixi@v0.9.6
2120
- name: Run integration tests
2221
id: tests
2322
run: pixi run test-integration
@@ -30,7 +29,7 @@ jobs:
3029
continue-on-error: true
3130
- name: Save integration logs
3231
if: ${{ always() }}
33-
uses: actions/upload-artifact@v4
32+
uses: actions/upload-artifact@v7
3433
with:
3534
name: integration-test-logs-${{ matrix.os }}
3635
path: tests/integration/resources/module/logs

template/tests/integration_test.py

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,31 +4,22 @@
44
Contents may be updated in future template updates.
55
"""
66

7-
import json
87
import subprocess
8+
import tomllib
99
from pathlib import Path
1010

1111
import pytest
1212
from clio_tools.data_module import ModuleInterface
1313

1414

1515
@pytest.fixture(scope="module")
16-
def pixi_environments(module_path) -> dict:
17-
"""Pixi environments defined for this project."""
18-
process = subprocess.run(
19-
["pixi", "info", "--json"],
20-
check=True,
21-
cwd=module_path,
22-
capture_output=True,
23-
text=True,
24-
)
25-
return {
26-
environment["name"]: environment
27-
for environment in json.loads(process.stdout)["environments_info"]
28-
}
16+
def pixi_platforms(module_path) -> list[str]:
17+
"""Pixi platforms defined for this project."""
18+
with (module_path / "pixi.toml").open("rb") as pixi_config:
19+
return tomllib.load(pixi_config)["workspace"]["platforms"]
2920

3021

31-
def test_snakemake_environments(module_path, pixi_environments, tmp_path):
22+
def test_snakemake_environments(module_path, pixi_platforms, tmp_path):
3223
"""All Snakemake environment files should be based on pixi counterparts."""
3324
env_dir = module_path / "workflow/envs"
3425
env_files = sorted(env_dir.glob("*.yaml"))
@@ -47,7 +38,7 @@ def test_snakemake_environments(module_path, pixi_environments, tmp_path):
4738
generated_yaml = output_dir / env_file.name
4839
assert generated_yaml.read_text() == env_file.read_text()
4940

50-
for platform in pixi_environments[env_name]["platforms"]:
41+
for platform in pixi_platforms:
5142
pin_file = env_dir / f"{env_name}.{platform}.pin.txt"
5243
assert pin_file.exists(), f"{env_name} has no conda pins for {platform}"
5344

0 commit comments

Comments
 (0)