Skip to content

Commit 0072f58

Browse files
committed
fix: Improve module linting test with better error handling
1 parent b30773c commit 0072f58

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

nf_core/modules/lint/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def lint(
161161

162162
if not remote_modules and not local_modules:
163163
log.error("No valid modules found in provided file paths")
164-
return
164+
return self
165165

166166
# Set all_modules to False since we're using specific files
167167
all_modules = False

tests/modules/test_lint.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -664,15 +664,21 @@ def test_modules_lint_file_path(self):
664664
"modules/nf-core/multiqc/environment.yml", # Environment file
665665
"modules/nf-core/star/align/tests/tags.yml", # Other test file
666666
]
667-
# Install the modules
668-
self.mods_install.install("fastqc")
669-
self.mods_install.install("bwa/mem")
670-
self.mods_install.install("samtools/sort")
671-
self.mods_install.install("multiqc")
672-
self.mods_install.install("star/align")
673667

668+
# Install modules first
669+
for module in ["fastqc", "bwa/mem", "samtools/sort", "multiqc", "star/align"]:
670+
try:
671+
self.mods_install.install(module)
672+
except Exception as e:
673+
self.fail(f"Failed to install module {module}: {str(e)}")
674+
675+
# Wait for modules to be installed
674676
module_lint = nf_core.modules.lint.ModuleLint(directory=self.nfcore_modules)
675-
module_lint.lint(print_results=False, files=test_paths)
677+
678+
# Run lint on the files
679+
lint_result = module_lint.lint(print_results=False, files=test_paths)
680+
if not lint_result:
681+
self.fail("Linting failed - no modules found")
676682

677683
# Check that the correct modules were identified
678684
linted_modules = set()

0 commit comments

Comments
 (0)