Skip to content

Commit 3c70c2c

Browse files
committed
use correct key for conda configs
1 parent 3411f6b commit 3c70c2c

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

nf_core/pipelines/containers_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,9 @@ def generate_container_configs(
184184
for platform, module_containers in containers.items():
185185
if not module_containers:
186186
continue
187+
container_key = "conda" if platform.startswith("conda_lock_") else "container"
187188
lines = [
188-
f"process {{ withName: '{module_name}' {{ container = '{container}' }} }}\n"
189+
f"process {{ withName: '{module_name}' {{ {container_key} = '{container}' }} }}\n"
189190
for module_name, container in sorted(module_containers.items())
190191
]
191192
config_path = self.workflow_directory / "conf" / f"containers_{platform}.config"

tests/pipelines/test_container_configs.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ def test_generate_all_container_configs(self) -> None:
6767
with cfg_path.open("r") as fh:
6868
content = fh.readlines()
6969
value = fastqc_meta_yml["containers"][runtime][arch][protocol]
70-
assert f"process {{ withName: 'FASTQC' {{ container = '{value}' }} }}\n" in content
70+
key = "conda" if p_name.startswith("conda_lock_") else "container"
71+
assert f"process {{ withName: 'FASTQC' {{ {key} = '{value}' }} }}\n" in content
7172

7273
def test_generate_container_configs_new_module_injected(self) -> None:
7374
"""new_module_name/path are used when nextflow inspect doesn't yet know about the module."""
@@ -96,7 +97,8 @@ def test_generate_container_configs_new_module_injected(self) -> None:
9697
cfg_path = conf_dir / f"containers_{p_name}.config"
9798
assert cfg_path.exists()
9899
value = fastqc_meta_yml["containers"][runtime][arch][protocol]
99-
assert f"process {{ withName: 'FASTQC' {{ container = '{value}' }} }}\n" in cfg_path.read_text()
100+
key = "conda" if p_name.startswith("conda_lock_") else "container"
101+
assert f"process {{ withName: 'FASTQC' {{ {key} = '{value}' }} }}\n" in cfg_path.read_text()
100102

101103
def test_generate_container_configs_removes_stale_entries(self) -> None:
102104
"""Stale config files are deleted when all their modules have been removed."""

0 commit comments

Comments
 (0)