Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/pr-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
- name: setup-pixi
uses: prefix-dev/setup-pixi@v0.8.3
uses: prefix-dev/setup-pixi@v0.9.6
- name: Run tests
run: pixi run test
7 changes: 3 additions & 4 deletions template/.github/workflows/pr-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: ["3.12"]
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7
- name: Setup pixi
uses: prefix-dev/setup-pixi@v0.8.3
uses: prefix-dev/setup-pixi@v0.9.6
- name: Run integration tests
id: tests
run: pixi run test-integration
Expand All @@ -30,7 +29,7 @@ jobs:
continue-on-error: true
- name: Save integration logs
if: ${{ always() }}
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v7
with:
name: integration-test-logs-${{ matrix.os }}
path: tests/integration/resources/module/logs
Expand Down
23 changes: 7 additions & 16 deletions template/tests/integration_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,22 @@
Contents may be updated in future template updates.
"""

import json
import subprocess
import tomllib
from pathlib import Path

import pytest
from clio_tools.data_module import ModuleInterface


@pytest.fixture(scope="module")
def pixi_environments(module_path) -> dict:
"""Pixi environments defined for this project."""
process = subprocess.run(
["pixi", "info", "--json"],
check=True,
cwd=module_path,
capture_output=True,
text=True,
)
return {
environment["name"]: environment
for environment in json.loads(process.stdout)["environments_info"]
}
def pixi_platforms(module_path) -> list[str]:
"""Pixi platforms defined for this project."""
with (module_path / "pixi.toml").open("rb") as pixi_config:
return tomllib.load(pixi_config)["workspace"]["platforms"]


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

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

Expand Down
Loading