From ca5e944f902fdfef9f6805d232debbecbe3dfeae Mon Sep 17 00:00:00 2001 From: mashehu Date: Mon, 1 Dec 2025 11:02:20 +0100 Subject: [PATCH 1/5] fix test for linting for version.yml --- tests/modules/lint/test_main_nf.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/modules/lint/test_main_nf.py b/tests/modules/lint/test_main_nf.py index 31b54b9466..a68c42619f 100644 --- a/tests/modules/lint/test_main_nf.py +++ b/tests/modules/lint/test_main_nf.py @@ -137,9 +137,10 @@ def test_main_nf_lint_with_alternative_registry(self): def test_topics_and_emits_version_check(self): """Test that main_nf version emit and topics check works correctly""" + self.mods_install.install("bioawk") # Lint a module known to have versions YAML in main.nf (for now) module_lint = nf_core.modules.lint.ModuleLint(directory=self.pipeline_dir) - module_lint.lint(print_results=False, module="samtools/sort") + module_lint.lint(print_results=False, module="bioawk") assert len(module_lint.failed) == 0, f"Linting failed with {[x.__dict__ for x in module_lint.failed]}" assert len(module_lint.warned) == 2, ( f"Linting warned with {[x.__dict__ for x in module_lint.warned]}, expected 2 warnings" From 2fdaae49d2abbc0ec64c9d762d1110a64e3ef770 Mon Sep 17 00:00:00 2001 From: nf-core-bot Date: Mon, 1 Dec 2025 10:04:07 +0000 Subject: [PATCH 2/5] [automated] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index dac1598d91..4d2a3909d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ ### Linting +- fix test for linting for version.yml ([#3947](https://github.com/nf-core/tools/pull/3947)) + ### Modules ### Subworkflows From 2e1b5a2ae2b920747e88a0a2c4520884c5b88805 Mon Sep 17 00:00:00 2001 From: mashehu Date: Mon, 1 Dec 2025 11:19:37 +0100 Subject: [PATCH 3/5] fix subworkflow lint test with topic channels --- tests/subworkflows/test_lint.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/subworkflows/test_lint.py b/tests/subworkflows/test_lint.py index 54ad7e7fc7..31651918c4 100644 --- a/tests/subworkflows/test_lint.py +++ b/tests/subworkflows/test_lint.py @@ -469,7 +469,9 @@ def test_lint_clean_patch(self): assert len(subworkflow_lint.failed) == 0, f"Linting failed with {[x.__dict__ for x in subworkflow_lint.failed]}" assert len(subworkflow_lint.passed) > 0 - assert len(subworkflow_lint.warned) == 0, f"Linting warned with {[x.__dict__ for x in subworkflow_lint.warned]}" + assert len(subworkflow_lint.warned) == 1, f"Linting warned with {[x.__dict__ for x in subworkflow_lint.warned]}" + warnings = [x.message for x in subworkflow_lint.warned] + assert "Can be ignored if the module is using topic channels" in warnings def test_lint_broken_patch(self): """Test linting a patched subworkflow when the patch is broken""" From 9964d8e809392cbd8d94ef0ef8ea1ea47b159eb5 Mon Sep 17 00:00:00 2001 From: mashehu Date: Tue, 9 Dec 2025 12:39:46 +0100 Subject: [PATCH 4/5] update lint tests --- nf_core/subworkflows/lint/main_nf.py | 2 +- tests/subworkflows/test_lint.py | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/nf_core/subworkflows/lint/main_nf.py b/nf_core/subworkflows/lint/main_nf.py index 2167cd20da..cb2177ed5d 100644 --- a/nf_core/subworkflows/lint/main_nf.py +++ b/nf_core/subworkflows/lint/main_nf.py @@ -169,7 +169,7 @@ def check_main_section(self, lines, included_components): ( "main_nf", "main_nf_include_versions", - f"Included component '{component}' versions are not added in main.nf Can be ignored if the module is using topic channels", + f"Included component '{component}' versions are not added in main.nf. Can be ignored if the module is using topic channels", self.main_nf, ) ) diff --git a/tests/subworkflows/test_lint.py b/tests/subworkflows/test_lint.py index 31651918c4..a1469b54f9 100644 --- a/tests/subworkflows/test_lint.py +++ b/tests/subworkflows/test_lint.py @@ -228,7 +228,7 @@ def test_subworkflows_lint_include_multiple_alias(self): subworkflow_lint.lint(print_results=False, subworkflow="bam_stats_samtools") assert len(subworkflow_lint.failed) >= 0, f"Linting failed with {[x.__dict__ for x in subworkflow_lint.failed]}" assert len(subworkflow_lint.passed) > 0 - assert len(subworkflow_lint.warned) == 2 + assert len(subworkflow_lint.warned) == 3 assert any( [ x.message == "Included component 'SAMTOOLS_STATS_1' versions are added in main.nf" @@ -241,6 +241,9 @@ def test_subworkflows_lint_include_multiple_alias(self): assert any( [x.message == "Included component 'SAMTOOLS_STATS_2' not used in main.nf" for x in subworkflow_lint.warned] ) + assert any( + [x.message == "Can be ignored if the module is using topic channels" for x in subworkflow_lint.warned] + ) # cleanup self.subworkflow_remove.remove("bam_stats_samtools", force=True) @@ -470,8 +473,9 @@ def test_lint_clean_patch(self): assert len(subworkflow_lint.failed) == 0, f"Linting failed with {[x.__dict__ for x in subworkflow_lint.failed]}" assert len(subworkflow_lint.passed) > 0 assert len(subworkflow_lint.warned) == 1, f"Linting warned with {[x.__dict__ for x in subworkflow_lint.warned]}" - warnings = [x.message for x in subworkflow_lint.warned] - assert "Can be ignored if the module is using topic channels" in warnings + assert any( + [x.message == "Can be ignored if the module is using topic channels" for x in subworkflow_lint.warned] + ) def test_lint_broken_patch(self): """Test linting a patched subworkflow when the patch is broken""" @@ -489,4 +493,7 @@ def test_lint_broken_patch(self): errors = [x.message for x in subworkflow_lint.failed] assert "Subworkflow patch cannot be cleanly applied" in errors assert len(subworkflow_lint.passed) > 0 - assert len(subworkflow_lint.warned) == 0, f"Linting warned with {[x.__dict__ for x in subworkflow_lint.warned]}" + assert len(subworkflow_lint.warned) == 1, f"Linting warned with {[x.__dict__ for x in subworkflow_lint.warned]}" + assert any( + [x.message == "Can be ignored if the module is using topic channels" for x in subworkflow_lint.warned] + ) From cbe803dc924f0706877ec6937daa1d14ea183e1a Mon Sep 17 00:00:00 2001 From: mashehu Date: Tue, 9 Dec 2025 13:21:46 +0100 Subject: [PATCH 5/5] fix lint --- tests/subworkflows/test_lint.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/tests/subworkflows/test_lint.py b/tests/subworkflows/test_lint.py index a1469b54f9..a092cd3c37 100644 --- a/tests/subworkflows/test_lint.py +++ b/tests/subworkflows/test_lint.py @@ -229,12 +229,6 @@ def test_subworkflows_lint_include_multiple_alias(self): assert len(subworkflow_lint.failed) >= 0, f"Linting failed with {[x.__dict__ for x in subworkflow_lint.failed]}" assert len(subworkflow_lint.passed) > 0 assert len(subworkflow_lint.warned) == 3 - assert any( - [ - x.message == "Included component 'SAMTOOLS_STATS_1' versions are added in main.nf" - for x in subworkflow_lint.passed - ] - ) assert any( [x.message == "Included component 'SAMTOOLS_STATS_1' used in main.nf" for x in subworkflow_lint.passed] ) @@ -242,7 +236,10 @@ def test_subworkflows_lint_include_multiple_alias(self): [x.message == "Included component 'SAMTOOLS_STATS_2' not used in main.nf" for x in subworkflow_lint.warned] ) assert any( - [x.message == "Can be ignored if the module is using topic channels" for x in subworkflow_lint.warned] + [ + x.message.endswith("Can be ignored if the module is using topic channels") + for x in subworkflow_lint.warned + ] ) # cleanup @@ -474,7 +471,10 @@ def test_lint_clean_patch(self): assert len(subworkflow_lint.passed) > 0 assert len(subworkflow_lint.warned) == 1, f"Linting warned with {[x.__dict__ for x in subworkflow_lint.warned]}" assert any( - [x.message == "Can be ignored if the module is using topic channels" for x in subworkflow_lint.warned] + [ + x.message.endswith("Can be ignored if the module is using topic channels") + for x in subworkflow_lint.warned + ] ) def test_lint_broken_patch(self): @@ -495,5 +495,8 @@ def test_lint_broken_patch(self): assert len(subworkflow_lint.passed) > 0 assert len(subworkflow_lint.warned) == 1, f"Linting warned with {[x.__dict__ for x in subworkflow_lint.warned]}" assert any( - [x.message == "Can be ignored if the module is using topic channels" for x in subworkflow_lint.warned] + [ + x.message.endswith("Can be ignored if the module is using topic channels") + for x in subworkflow_lint.warned + ] )