Skip to content

Commit

Permalink
fix: Improve module linting test with better error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
edmundmiller committed Nov 20, 2024
1 parent b30773c commit 0072f58
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion nf_core/modules/lint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ def lint(

if not remote_modules and not local_modules:
log.error("No valid modules found in provided file paths")
return
return self

# Set all_modules to False since we're using specific files
all_modules = False
Expand Down
20 changes: 13 additions & 7 deletions tests/modules/test_lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -664,15 +664,21 @@ def test_modules_lint_file_path(self):
"modules/nf-core/multiqc/environment.yml", # Environment file
"modules/nf-core/star/align/tests/tags.yml", # Other test file
]
# Install the modules
self.mods_install.install("fastqc")
self.mods_install.install("bwa/mem")
self.mods_install.install("samtools/sort")
self.mods_install.install("multiqc")
self.mods_install.install("star/align")

# Install modules first
for module in ["fastqc", "bwa/mem", "samtools/sort", "multiqc", "star/align"]:
try:
self.mods_install.install(module)
except Exception as e:
self.fail(f"Failed to install module {module}: {str(e)}")

# Wait for modules to be installed
module_lint = nf_core.modules.lint.ModuleLint(directory=self.nfcore_modules)
module_lint.lint(print_results=False, files=test_paths)

# Run lint on the files
lint_result = module_lint.lint(print_results=False, files=test_paths)
if not lint_result:
self.fail("Linting failed - no modules found")

# Check that the correct modules were identified
linted_modules = set()
Expand Down

0 comments on commit 0072f58

Please sign in to comment.