From 3d0051782b61563145f6c68b238071336a101e04 Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Thu, 3 Nov 2022 13:49:44 +0100 Subject: [PATCH 1/4] add tests for subworkflows install command --- nf_core/components/components_install.py | 15 ++--- nf_core/modules/install.py | 2 +- nf_core/modules/modules_json.py | 10 +-- nf_core/modules/patch.py | 2 +- nf_core/modules/update.py | 48 +++++++++++---- nf_core/subworkflows/install.py | 2 +- tests/modules/install.py | 2 +- tests/modules/update.py | 20 ++++-- tests/subworkflows/install.py | 78 ++++++++++++++++++++++++ tests/test_modules.py | 1 + tests/test_subworkflows.py | 18 +++++- tests/utils.py | 1 + 12 files changed, 167 insertions(+), 32 deletions(-) create mode 100644 tests/subworkflows/install.py diff --git a/nf_core/components/components_install.py b/nf_core/components/components_install.py index 9cd40005d2..ed730edeff 100644 --- a/nf_core/components/components_install.py +++ b/nf_core/components/components_install.py @@ -42,19 +42,20 @@ def collect_and_verify_name(component_type, component, modules_repo): return component -def check_component_installed(component_type, component, current_version, component_dir, modules_repo, force): +def check_component_installed(component_type, component, current_version, component_dir, modules_repo, force, prompt): """ Check that the module/subworkflow is not already installed """ if (current_version is not None and os.path.exists(component_dir)) and not force: log.info(f"{component_type[:-1].title()} is already installed.") - message = "?" if component_type == "modules" else " of this subworkflow and all it's imported modules?" - force = questionary.confirm( - f"{component_type[:-1].title()} {component} is already installed. \nDo you want to force the reinstallation{message}", - style=nf_core.utils.nfcore_question_style, - default=False, - ).unsafe_ask() + if prompt: + message = "?" if component_type == "modules" else " of this subworkflow and all it's imported modules?" + force = questionary.confirm( + f"{component_type[:-1].title()} {component} is already installed. \nDo you want to force the reinstallation{message}", + style=nf_core.utils.nfcore_question_style, + default=False, + ).unsafe_ask() if not force: repo_flag = "" if modules_repo.repo_path == NF_CORE_MODULES_NAME else f"-g {modules_repo.remote_url} " diff --git a/nf_core/modules/install.py b/nf_core/modules/install.py index e928eb4c79..ad93049f56 100644 --- a/nf_core/modules/install.py +++ b/nf_core/modules/install.py @@ -69,7 +69,7 @@ def install(self, module, silent=False): # Check that the module is not already installed if not nf_core.components.components_install.check_component_installed( - self.component_type, module, current_version, module_dir, self.modules_repo, self.force + self.component_type, module, current_version, module_dir, self.modules_repo, self.force, self.prompt ): return False diff --git a/nf_core/modules/modules_json.py b/nf_core/modules/modules_json.py index 96a62dd2ef..29eb8c3309 100644 --- a/nf_core/modules/modules_json.py +++ b/nf_core/modules/modules_json.py @@ -803,9 +803,9 @@ def get_all_components(self, component_type): return self.pipeline_modules - def get_module_branch(self, module, repo_url, install_dir): + def get_component_branch(self, component_type, component, repo_url, install_dir): """ - Gets the branch from which the module was installed + Gets the branch from which the module/subworkflow was installed Returns: (str): The branch name @@ -817,14 +817,14 @@ def get_module_branch(self, module, repo_url, install_dir): branch = ( self.modules_json["repos"] .get(repo_url, {}) - .get("modules", {}) + .get(component_type, {}) .get(install_dir, {}) - .get(module, {}) + .get(component, {}) .get("branch") ) if branch is None: raise LookupError( - f"Could not find branch information for module '{Path(install_dir, module)}'." + f"Could not find branch information for component '{Path(install_dir, component)}'." f"Please remove the 'modules.json' and rerun the command to recreate it" ) return branch diff --git a/nf_core/modules/patch.py b/nf_core/modules/patch.py index 19b3d6a407..5d51b0beb7 100644 --- a/nf_core/modules/patch.py +++ b/nf_core/modules/patch.py @@ -62,7 +62,7 @@ def patch(self, module=None): f"The '{module_fullname}' module does not have a valid version in the 'modules.json' file. Cannot compute patch" ) # Get the module branch and reset it in the ModulesRepo object - module_branch = self.modules_json.get_module_branch(module, self.modules_repo.remote_url, module_dir) + module_branch = self.modules_json.get_component_branch(self.component_type, module, self.modules_repo.remote_url, module_dir) if module_branch != self.modules_repo.branch: self.modules_repo.setup_branch(module_branch) diff --git a/nf_core/modules/update.py b/nf_core/modules/update.py index 8fb3b45d49..9e2a829d1d 100644 --- a/nf_core/modules/update.py +++ b/nf_core/modules/update.py @@ -315,7 +315,9 @@ def get_single_module_info(self, module): log.info(f"Updating module to ({sha})") # Check if the update branch is the same as the installation branch - current_branch = self.modules_json.get_module_branch(module, self.modules_repo.remote_url, install_dir) + current_branch = self.modules_json.get_component_branch( + self.component_type, module, self.modules_repo.remote_url, install_dir + ) new_branch = self.modules_repo.branch if current_branch != new_branch: log.warning( @@ -361,11 +363,23 @@ def get_all_modules_info(self, branch=None): for module_dir, module in modules: try: modules_info[repo_name][module_dir].append( - (module, self.sha, self.modules_json.get_module_branch(module, repo_name, module_dir)) + ( + module, + self.sha, + self.modules_json.get_component_branch( + self.component_type, module, repo_name, module_dir + ), + ) ) except KeyError: modules_info[repo_name][module_dir] = [ - (module, self.sha, self.modules_json.get_module_branch(module, repo_name, module_dir)) + ( + module, + self.sha, + self.modules_json.get_component_branch( + self.component_type, module, repo_name, module_dir + ), + ) ] elif isinstance(self.update_config[repo_name], dict): # If it is a dict, then there are entries for individual modules or module directories @@ -381,7 +395,9 @@ def get_all_modules_info(self, branch=None): ( module, custom_sha, - self.modules_json.get_module_branch(module, repo_name, module_dir), + self.modules_json.get_component_branch( + self.component_type, module, repo_name, module_dir + ), ) ) except KeyError: @@ -389,7 +405,9 @@ def get_all_modules_info(self, branch=None): ( module, custom_sha, - self.modules_json.get_module_branch(module, repo_name, module_dir), + self.modules_json.get_component_branch( + self.component_type, module, repo_name, module_dir + ), ) ] if self.sha is not None: @@ -409,7 +427,9 @@ def get_all_modules_info(self, branch=None): ( module, self.sha, - self.modules_json.get_module_branch(module, repo_name, module_dir), + self.modules_json.get_component_branch( + self.component_type, module, repo_name, module_dir + ), ) ) except KeyError: @@ -417,7 +437,9 @@ def get_all_modules_info(self, branch=None): ( module, self.sha, - self.modules_json.get_module_branch(module, repo_name, module_dir), + self.modules_json.get_component_branch( + self.component_type, module, repo_name, module_dir + ), ) ] elif isinstance(dir_config[module], str): @@ -428,7 +450,9 @@ def get_all_modules_info(self, branch=None): ( module, custom_sha, - self.modules_json.get_module_branch(module, repo_name, module_dir), + self.modules_json.get_component_branch( + self.component_type, module, repo_name, module_dir + ), ) ) except KeyError: @@ -436,7 +460,9 @@ def get_all_modules_info(self, branch=None): ( module, custom_sha, - self.modules_json.get_module_branch(module, repo_name, module_dir), + self.modules_json.get_component_branch( + self.component_type, module, repo_name, module_dir + ), ) ] if self.sha is not None: @@ -455,11 +481,11 @@ def get_all_modules_info(self, branch=None): for module_dir, module in modules: try: modules_info[repo_name][module_dir].append( - (module, custom_sha, self.modules_json.get_module_branch(module, repo_name, module_dir)) + (module, custom_sha, self.modules_json.get_component_branch(self.component_type, module, repo_name, module_dir)) ) except KeyError: modules_info[repo_name][module_dir] = [ - (module, custom_sha, self.modules_json.get_module_branch(module, repo_name, module_dir)) + (module, custom_sha, self.modules_json.get_component_branch(self.component_type, module, repo_name, module_dir)) ] if self.sha is not None: overridden_repos.append(repo_name) diff --git a/nf_core/subworkflows/install.py b/nf_core/subworkflows/install.py index 439cf187b7..aa87a0013b 100644 --- a/nf_core/subworkflows/install.py +++ b/nf_core/subworkflows/install.py @@ -69,7 +69,7 @@ def install(self, subworkflow, silent=False): # Check that the subworkflow is not already installed if not nf_core.components.components_install.check_component_installed( - self.component_type, subworkflow, current_version, subworkflow_dir, self.modules_repo, self.force + self.component_type, subworkflow, current_version, subworkflow_dir, self.modules_repo, self.force, self.prompt ): return False diff --git a/tests/modules/install.py b/tests/modules/install.py index 7b7d86c2d7..8d43d1c588 100644 --- a/tests/modules/install.py +++ b/tests/modules/install.py @@ -67,4 +67,4 @@ def test_modules_install_different_branch_succeed(self): # Verify that the branch entry was added correctly modules_json = ModulesJson(self.pipeline_dir) - assert modules_json.get_module_branch("fastp", GITLAB_URL, GITLAB_REPO) == GITLAB_BRANCH_TEST_BRANCH + assert modules_json.get_component_branch(self.component_type, "fastp", GITLAB_URL, GITLAB_REPO) == GITLAB_BRANCH_TEST_BRANCH diff --git a/tests/modules/update.py b/tests/modules/update.py index 9ff098d88e..9ca293add8 100644 --- a/tests/modules/update.py +++ b/tests/modules/update.py @@ -231,7 +231,10 @@ def test_update_different_branch_single_module(self): # Verify that the branch entry was updated correctly modules_json = ModulesJson(self.pipeline_dir) - assert modules_json.get_module_branch("fastp", GITLAB_URL, GITLAB_REPO) == GITLAB_BRANCH_TEST_BRANCH + assert ( + modules_json.get_component_branch(self.component_type, "fastp", GITLAB_URL, GITLAB_REPO) + == GITLAB_BRANCH_TEST_BRANCH + ) assert modules_json.get_module_version("fastp", GITLAB_URL, GITLAB_REPO) == GITLAB_BRANCH_TEST_NEW_SHA @@ -249,10 +252,16 @@ def test_update_different_branch_mixed_modules_main(self): modules_json = ModulesJson(self.pipeline_dir) # Verify that the branch entry was updated correctly - assert modules_json.get_module_branch("fastp", GITLAB_URL, GITLAB_REPO) == GITLAB_BRANCH_TEST_BRANCH + assert ( + modules_json.get_component_branch(self.component_type, "fastp", GITLAB_URL, GITLAB_REPO) + == GITLAB_BRANCH_TEST_BRANCH + ) assert modules_json.get_module_version("fastp", GITLAB_URL, GITLAB_REPO) == GITLAB_BRANCH_TEST_NEW_SHA # MultiQC is present in both branches but should've been updated using the 'main' branch - assert modules_json.get_module_branch("multiqc", GITLAB_URL, GITLAB_REPO) == GITLAB_DEFAULT_BRANCH + assert ( + modules_json.get_component_branch(self.component_type, "multiqc", GITLAB_URL, GITLAB_REPO) + == GITLAB_DEFAULT_BRANCH + ) def test_update_different_branch_mix_modules_branch_test(self): @@ -272,7 +281,10 @@ def test_update_different_branch_mix_modules_branch_test(self): ) assert update_obj.update() - assert modules_json.get_module_branch("multiqc", GITLAB_URL, GITLAB_REPO) == GITLAB_BRANCH_TEST_BRANCH + assert ( + modules_json.get_component_branch(self.component_type, "multiqc", GITLAB_URL, GITLAB_REPO) + == GITLAB_BRANCH_TEST_BRANCH + ) assert modules_json.get_module_version("multiqc", GITLAB_URL, GITLAB_REPO) == GITLAB_BRANCH_TEST_NEW_SHA diff --git a/tests/subworkflows/install.py b/tests/subworkflows/install.py new file mode 100644 index 0000000000..94b2d79ba0 --- /dev/null +++ b/tests/subworkflows/install.py @@ -0,0 +1,78 @@ +import os + +import pytest + +from nf_core.modules.modules_json import ModulesJson +from nf_core.subworkflows.install import SubworkflowInstall + +from ..utils import ( + GITLAB_BRANCH_TEST_BRANCH, + GITLAB_REPO, + GITLAB_SUBWORKFLOWS_BRANCH, + GITLAB_URL, + with_temporary_folder, +) + + +def test_subworkflow_install_nopipeline(self): + """Test installing a subworkflow - no pipeline given""" + self.subworkflow_install.dir = None + assert self.subworkflow_install.install("foo") is False + + +@with_temporary_folder +def test_subworkflows_install_emptypipeline(self, tmpdir): + """Test installing a subworkflow - empty dir given""" + os.mkdir(os.path.join(tmpdir, "nf-core-pipe")) + self.subworkflow_install.dir = os.path.join(tmpdir, "nf-core-pipe") + with pytest.raises(UserWarning) as excinfo: + self.subworkflow_install.install("foo") + assert "Could not find a 'main.nf' or 'nextflow.config' file" in str(excinfo.value) + + +def test_subworkflows_install_nosubworkflow(self): + """Test installing a subworkflow - unrecognised subworkflow given""" + assert self.subworkflow_install.install("foo") is False + + +def test_subworkflows_install_bam_sort_stats_samtools(self): + """Test installing a subworkflow - bam_sort_stats_samtools""" + assert self.subworkflow_install.install("bam_sort_stats_samtools") is not False + subworkflow_path = os.path.join(self.subworkflow_install.dir, "subworkflows", "nf-core", "bam_sort_stats_samtools") + sub_subworkflow_path = os.path.join(self.subworkflow_install.dir, "subworkflows", "nf-core", "bam_stats_samtools") + samtools_index_path = os.path.join(self.subworkflow_install.dir, "modules", "nf-core", "samtools", "index") + samtools_sort_path = os.path.join(self.subworkflow_install.dir, "modules", "nf-core", "samtools", "sort") + samtools_stats_path = os.path.join(self.subworkflow_install.dir, "modules", "nf-core", "samtools", "stats") + samtools_idxstats_path = os.path.join(self.subworkflow_install.dir, "modules", "nf-core", "samtools", "idxstats") + samtools_flagstat_path = os.path.join(self.subworkflow_install.dir, "modules", "nf-core", "samtools", "flagstat") + assert os.path.exists(subworkflow_path) + assert os.path.exists(sub_subworkflow_path) + assert os.path.exists(samtools_index_path) + assert os.path.exists(samtools_sort_path) + assert os.path.exists(samtools_stats_path) + assert os.path.exists(samtools_idxstats_path) + assert os.path.exists(samtools_flagstat_path) + + +def test_subworkflows_install_bam_sort_stats_samtools_twice(self): + """Test installing a subworkflow - bam_sort_stats_samtools already there""" + self.subworkflow_install.install("bam_sort_stats_samtools") + assert self.subworkflow_install.install("bam_sort_stats_samtools") is False + + +def test_subworkflows_install_from_gitlab(self): + """Test installing a subworkflow from GitLab""" + assert self.subworkflow_install_gitlab.install("bam_stats_samtools") is True + # Verify that the branch entry was added correctly + modules_json = ModulesJson(self.pipeline_dir) + assert ( + modules_json.get_component_branch(self.component_type, "bam_stats_samtools", GITLAB_URL, GITLAB_REPO) + == GITLAB_SUBWORKFLOWS_BRANCH + ) + + +def test_subworkflows_install_different_branch_fail(self): + """Test installing a subworkflow from a different branch""" + install_obj = SubworkflowInstall(self.pipeline_dir, remote_url=GITLAB_URL, branch=GITLAB_BRANCH_TEST_BRANCH) + # The bam_stats_samtools subworkflow does not exists in the branch-test branch + assert install_obj.install("bam_stats_samtools") is False diff --git a/tests/test_modules.py b/tests/test_modules.py index e1b9609699..0b68dc9df2 100644 --- a/tests/test_modules.py +++ b/tests/test_modules.py @@ -51,6 +51,7 @@ class TestModules(unittest.TestCase): def setUp(self): """Create a new PipelineSchema and Launch objects""" self.tmp_dir = tempfile.mkdtemp() + self.component_type = "modules" # Set up the schema root_repo_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) diff --git a/tests/test_subworkflows.py b/tests/test_subworkflows.py index ea4fa986dd..dd4539a246 100644 --- a/tests/test_subworkflows.py +++ b/tests/test_subworkflows.py @@ -13,7 +13,7 @@ import nf_core.modules import nf_core.subworkflows -from .utils import GITLAB_URL, mock_api_calls +from .utils import GITLAB_SUBWORKFLOWS_BRANCH, GITLAB_URL, mock_api_calls def create_modules_repo_dummy(tmp_dir): @@ -46,6 +46,7 @@ class TestSubworkflows(unittest.TestCase): def setUp(self): """Create a new PipelineStructure and Launch objects""" self.tmp_dir = tempfile.mkdtemp() + self.component_type = "subworkflows" # Set up the pipeline structure root_repo_dir = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) @@ -55,6 +56,12 @@ def setUp(self): "mypipeline", "it is mine", "me", no_git=True, outdir=self.pipeline_dir, plain=True ).init_pipeline() + # Set up install objects + self.subworkflow_install = nf_core.subworkflows.SubworkflowInstall(self.pipeline_dir, prompt=False, force=False) + self.subworkflow_install_gitlab = nf_core.subworkflows.SubworkflowInstall( + self.pipeline_dir, prompt=False, force=False, remote_url=GITLAB_URL, branch=GITLAB_SUBWORKFLOWS_BRANCH + ) + # Set up the nf-core/modules repo dummy self.nfcore_modules = create_modules_repo_dummy(self.tmp_dir) @@ -67,6 +74,15 @@ def setUp(self): test_subworkflows_create_nfcore_modules, test_subworkflows_create_succeed, ) + from .subworkflows.install import ( + test_subworkflow_install_nopipeline, + test_subworkflows_install_bam_sort_stats_samtools, + test_subworkflows_install_bam_sort_stats_samtools_twice, + test_subworkflows_install_different_branch_fail, + test_subworkflows_install_emptypipeline, + test_subworkflows_install_from_gitlab, + test_subworkflows_install_nosubworkflow, + ) from .subworkflows.subworkflows_test import ( test_subworkflows_test_check_inputs, test_subworkflows_test_no_installed_subworkflows, diff --git a/tests/utils.py b/tests/utils.py index 483f817f20..65c7d48758 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -15,6 +15,7 @@ GITLAB_URL = "https://gitlab.com/nf-core/modules-test.git" GITLAB_REPO = "nf-core" GITLAB_DEFAULT_BRANCH = "main-restructure" +GITLAB_SUBWORKFLOWS_BRANCH = "subworkflows" # Branch test stuff GITLAB_BRANCH_TEST_BRANCH = "branch-tester-restructure" GITLAB_BRANCH_TEST_OLD_SHA = "bce3f17980b8d1beae5e917cfd3c65c0c69e04b5" From eed9bfe51731414fb569138faef78a08c2135803 Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Thu, 3 Nov 2022 13:59:18 +0100 Subject: [PATCH 2/4] modify changelog --- CHANGELOG.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61ca21ffed..0428304c02 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,9 +16,7 @@ - Fix bug when updating modules from old version in old folder structure - Don't remove local copy of modules repo, only update it with fetch ([#1881](https://github.com/nf-core/tools/pull/1881)) - Add subworkflow commands create-test-yml, create and install ([#1897](https://github.com/nf-core/tools/pull/1897)) -- Update subworkflows install so it installs also imported modules and subworkflows ([#1904](https://github.com/nf-core/tools/pull/1904)) - Improve test coverage of `sync.py` and `__main__.py` ([#1936](https://github.com/nf-core/tools/pull/1936), [#1965](https://github.com/nf-core/tools/pull/1965)) -- `check_up_to_date()` function from `modules_json` also checks for subworkflows. - The default branch can now be specified when creating a new pipeline repo [#1959](https://github.com/nf-core/tools/pull/1959). - Only warn when checking that the pipeline directory contains a `main.nf` and a `nextflow.config` file if the pipeline is not an nf-core pipeline [#1964](https://github.com/nf-core/tools/pull/1964) - Add file `versions.yml` when generating `test.yml` with `nf-core modules create-test-yml` but don't check for md5sum [#1963](https://github.com/nf-core/tools/pull/1963) @@ -31,6 +29,12 @@ - Update patch file paths if the modules directory has the old structure ([#1878](https://github.com/nf-core/tools/pull/1878)) +### Subworkflows + +- Add tests for subworkflows install command ([#1996](https://github.com/nf-core/tools/pull/1996)) +- `check_up_to_date()` function from `modules_json` also checks for subworkflows. +- Update subworkflows install so it installs also imported modules and subworkflows ([#1904](https://github.com/nf-core/tools/pull/1904)) + ## [v2.6 - Tin Octopus](https://github.com/nf-core/tools/releases/tag/2.6) - [2022-10-04] ### Template From 8473fda117b2edc9744385e09593203d5a9fc565 Mon Sep 17 00:00:00 2001 From: nf-core-bot Date: Thu, 3 Nov 2022 15:12:14 +0000 Subject: [PATCH 3/4] [automated] Fix code linting --- nf_core/modules/patch.py | 4 +++- nf_core/modules/update.py | 16 ++++++++++++++-- nf_core/subworkflows/install.py | 8 +++++++- tests/modules/install.py | 5 ++++- 4 files changed, 28 insertions(+), 5 deletions(-) diff --git a/nf_core/modules/patch.py b/nf_core/modules/patch.py index 5d51b0beb7..84e839a033 100644 --- a/nf_core/modules/patch.py +++ b/nf_core/modules/patch.py @@ -62,7 +62,9 @@ def patch(self, module=None): f"The '{module_fullname}' module does not have a valid version in the 'modules.json' file. Cannot compute patch" ) # Get the module branch and reset it in the ModulesRepo object - module_branch = self.modules_json.get_component_branch(self.component_type, module, self.modules_repo.remote_url, module_dir) + module_branch = self.modules_json.get_component_branch( + self.component_type, module, self.modules_repo.remote_url, module_dir + ) if module_branch != self.modules_repo.branch: self.modules_repo.setup_branch(module_branch) diff --git a/nf_core/modules/update.py b/nf_core/modules/update.py index 9e2a829d1d..dcdde1c67b 100644 --- a/nf_core/modules/update.py +++ b/nf_core/modules/update.py @@ -481,11 +481,23 @@ def get_all_modules_info(self, branch=None): for module_dir, module in modules: try: modules_info[repo_name][module_dir].append( - (module, custom_sha, self.modules_json.get_component_branch(self.component_type, module, repo_name, module_dir)) + ( + module, + custom_sha, + self.modules_json.get_component_branch( + self.component_type, module, repo_name, module_dir + ), + ) ) except KeyError: modules_info[repo_name][module_dir] = [ - (module, custom_sha, self.modules_json.get_component_branch(self.component_type, module, repo_name, module_dir)) + ( + module, + custom_sha, + self.modules_json.get_component_branch( + self.component_type, module, repo_name, module_dir + ), + ) ] if self.sha is not None: overridden_repos.append(repo_name) diff --git a/nf_core/subworkflows/install.py b/nf_core/subworkflows/install.py index aa87a0013b..494c03c24b 100644 --- a/nf_core/subworkflows/install.py +++ b/nf_core/subworkflows/install.py @@ -69,7 +69,13 @@ def install(self, subworkflow, silent=False): # Check that the subworkflow is not already installed if not nf_core.components.components_install.check_component_installed( - self.component_type, subworkflow, current_version, subworkflow_dir, self.modules_repo, self.force, self.prompt + self.component_type, + subworkflow, + current_version, + subworkflow_dir, + self.modules_repo, + self.force, + self.prompt, ): return False diff --git a/tests/modules/install.py b/tests/modules/install.py index 8d43d1c588..1c3f1aefc7 100644 --- a/tests/modules/install.py +++ b/tests/modules/install.py @@ -67,4 +67,7 @@ def test_modules_install_different_branch_succeed(self): # Verify that the branch entry was added correctly modules_json = ModulesJson(self.pipeline_dir) - assert modules_json.get_component_branch(self.component_type, "fastp", GITLAB_URL, GITLAB_REPO) == GITLAB_BRANCH_TEST_BRANCH + assert ( + modules_json.get_component_branch(self.component_type, "fastp", GITLAB_URL, GITLAB_REPO) + == GITLAB_BRANCH_TEST_BRANCH + ) From 36df3fb73c222d686afc23ab68d01b020f0cc8f8 Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Fri, 4 Nov 2022 10:54:30 +0100 Subject: [PATCH 4/4] fix some linting issues --- nf_core/subworkflows/create.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/nf_core/subworkflows/create.py b/nf_core/subworkflows/create.py index 7181498ef5..481bd1ea94 100644 --- a/nf_core/subworkflows/create.py +++ b/nf_core/subworkflows/create.py @@ -9,7 +9,6 @@ import os import yaml -from packaging.version import parse as parse_version import nf_core import nf_core.components.components_create @@ -114,7 +113,7 @@ def create(self): pytest_modules_yml = dict(sorted(pytest_modules_yml.items())) with open(os.path.join(self.directory, "tests", "config", "pytest_modules.yml"), "w") as fh: yaml.dump(pytest_modules_yml, fh, sort_keys=True, Dumper=nf_core.utils.custom_yaml_dumper()) - except FileNotFoundError as e: + except FileNotFoundError: raise UserWarning("Could not open 'tests/config/pytest_modules.yml' file!") new_files = list(self.file_paths.values())