Skip to content

Commit 740cf6a

Browse files
committed
add test for prohibiting conda default channel
1 parent 68364ff commit 740cf6a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/modules/test_lint.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,6 +570,21 @@ def test_modules_environment_yml_file_mixed_dependencies(self):
570570
assert len(module_lint.passed) > 0
571571
assert len(module_lint.warned) >= 0
572572

573+
def test_modules_environment_yml_file_default_channel_fails(self):
574+
"""Test linting a module with a default channel set in the environment.yml file, which should fail"""
575+
with open(Path(self.nfcore_modules, "modules", "nf-core", "bpipe", "test", "environment.yml")) as fh:
576+
yaml_content = yaml.safe_load(fh)
577+
yaml_content["channels"] = ["bioconda", "default"]
578+
with open(Path(self.nfcore_modules, "modules", "nf-core", "bpipe", "test", "environment.yml"), "w") as fh:
579+
fh.write(yaml.dump(yaml_content))
580+
module_lint = nf_core.modules.lint.ModuleLint(directory=self.nfcore_modules)
581+
module_lint.lint(print_results=False, module="bpipe/test")
582+
583+
assert len(module_lint.failed) == 1, f"Linting failed with {[x.__dict__ for x in module_lint.failed]}"
584+
assert len(module_lint.passed) > 0
585+
assert len(module_lint.warned) >= 0
586+
assert module_lint.failed[0].lint_test == "environment_yml_valid"
587+
573588
def test_modules_meta_yml_incorrect_licence_field(self):
574589
"""Test linting a module with an incorrect Licence field in meta.yml"""
575590
with open(Path(self.nfcore_modules, "modules", "nf-core", "bpipe", "test", "meta.yml")) as fh:

0 commit comments

Comments
 (0)