File tree Expand file tree Collapse file tree 4 files changed +27
-0
lines changed Expand file tree Collapse file tree 4 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 4141### Modules
4242
4343- Add ` topics ` to the template + update linting ([ #3779 ] ( https://github.com/nf-core/tools/pull/3779 ) )
44+ - Preserve the value of self.modules_repo across nested calls ([ #3881 ] ( https://github.com/nf-core/tools/pull/3881 ) )
4445
4546### Subworkflows
4647
Original file line number Diff line number Diff line change @@ -194,6 +194,7 @@ def install_included_components(self, subworkflow_dir):
194194 """
195195 Install included modules and subworkflows
196196 """
197+ ini_modules_repo = self .modules_repo
197198 modules_to_install , subworkflows_to_install = get_components_to_install (subworkflow_dir )
198199 for s_install in subworkflows_to_install :
199200 original_installed = self .installed_by
@@ -208,6 +209,8 @@ def install_included_components(self, subworkflow_dir):
208209 self .install (m_install , silent = True )
209210 self .component_type = original_component_type
210211 self .installed_by = original_installed
212+ # self.install will have modified self.modules_repo. Restore its original value
213+ self .modules_repo = ini_modules_repo
211214
212215 def collect_and_verify_name (
213216 self , component : str | None , modules_repo : "nf_core.modules.modules_repo.ModulesRepo"
Original file line number Diff line number Diff line change @@ -95,6 +95,25 @@ def test_subworkflows_install_across_organizations(self):
9595 "fastq_trim_fastp_fastqc"
9696 ]
9797
98+ def test_subworkflows_install_across_organizations_only_nfcore (self ):
99+ """Test installing a subworkflow from a different organization but only with modules from nf-core"""
100+ # The wget_subwf subworkflow contains nf-core/modules/wget (and only that). It used to not be possible to install it twice
101+ # because of some org/nf-core confusion (https://github.com/nf-core/tools/issues/3876)
102+ # Note that we use two SubworkflowInstall to avoid cross-contamination
103+ for swfi in (self .subworkflow_install_cross_org , self .subworkflow_install_cross_org_again ):
104+ swfi .install ("wget_subwf" )
105+ # Verify that the installed_by entry was added correctly
106+ modules_json = ModulesJson (self .pipeline_dir )
107+ mod_json = modules_json .get_modules_json ()
108+ assert mod_json ["repos" ][CROSS_ORGANIZATION_URL ]["subworkflows" ]["nf-core-test" ]["wget_subwf" ][
109+ "installed_by"
110+ ] == ["subworkflows" ]
111+ # This assertion used to fail on the second attempt
112+ assert (
113+ "wget_subwf"
114+ not in mod_json ["repos" ]["https://github.com/nf-core/modules.git" ]["subworkflows" ]["nf-core" ]
115+ )
116+
98117 def test_subworkflow_install_with_same_module (self ):
99118 """Test installing a subworkflow with a module from a different organization that is already installed from another org"""
100119 # The fastq_trim_fastp_fastqc subworkflow contains the cross-org fastqc module, not the nf-core one
Original file line number Diff line number Diff line change @@ -108,6 +108,10 @@ def setUp(self):
108108 self .subworkflow_install_cross_org = nf_core .subworkflows .SubworkflowInstall (
109109 self .pipeline_dir , remote_url = CROSS_ORGANIZATION_URL , branch = CROSS_ORGANIZATION_BRANCH
110110 )
111+ # Another instance to avoid cross-contamination
112+ self .subworkflow_install_cross_org_again = nf_core .subworkflows .SubworkflowInstall (
113+ self .pipeline_dir , remote_url = CROSS_ORGANIZATION_URL , branch = CROSS_ORGANIZATION_BRANCH
114+ )
111115
112116 self .mods_install = nf_core .modules .install .ModuleInstall (self .pipeline_dir , prompt = False , force = True )
113117
You can’t perform that action at this time.
0 commit comments