Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions nf_core/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,8 @@ def create_test_yml(ctx, tool, run_tests, output, force, no_prompts):
test_yml_output_path=output,
force_overwrite=force,
no_prompts=no_prompts,
remote_url=ctx.obj["modules_repo_url"],
branch=ctx.obj["modules_repo_branch"],
)
meta_builder.run()
except (UserWarning, LookupError) as e:
Expand Down Expand Up @@ -979,6 +981,8 @@ def create_test_yml(ctx, subworkflow, run_tests, output, force, no_prompts):
test_yml_output_path=output,
force_overwrite=force,
no_prompts=no_prompts,
remote_url=ctx.obj["modules_repo_url"],
branch=ctx.obj["modules_repo_branch"],
)
meta_builder.run()
except (UserWarning, LookupError) as e:
Expand Down
15 changes: 9 additions & 6 deletions nf_core/modules/test_yml_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,13 @@ def __init__(
test_yml_output_path=None,
force_overwrite=False,
no_prompts=False,
remote_url=None,
branch=None,
):
super().__init__("modules", directory)
super().__init__("modules", directory, remote_url, branch)
self.module_name = module_name
self.remote_url = remote_url
self.branch = branch
self.run_tests = run_tests
self.test_yml_output_path = test_yml_output_path
self.force_overwrite = force_overwrite
Expand Down Expand Up @@ -75,10 +79,9 @@ def check_inputs(self):

# Get the tool name if not specified
if self.module_name is None:
modules_repo = ModulesRepo()
self.module_name = questionary.autocomplete(
"Tool name:",
choices=modules_repo.get_avail_components(self.component_type),
choices=self.components_from_repo(self.org),
style=nf_core.utils.nfcore_question_style,
).unsafe_ask()
self.module_dir = os.path.join(self.default_modules_path, *self.module_name.split("/"))
Expand All @@ -97,7 +100,7 @@ def check_inputs(self):

# Get the output YAML file / check it does not already exist
while self.test_yml_output_path is None:
default_val = f"tests/modules/nf-core/{self.module_name}/test.yml"
default_val = f"tests/modules/{self.org}/{self.module_name}/test.yml"
if self.no_prompts:
self.test_yml_output_path = default_val
else:
Expand Down Expand Up @@ -173,8 +176,8 @@ def build_single_test(self, entry_point):
# Don't think we need the last `-c` flag, but keeping to avoid having to update 100s modules.
# See https://github.com/nf-core/tools/issues/1562
default_val = (
f"nextflow run ./tests/modules/nf-core/{self.module_name} -entry {entry_point} "
f"-c ./tests/config/nextflow.config -c ./tests/modules/nf-core/{self.module_name}/nextflow.config"
f"nextflow run ./tests/modules/{self.org}/{self.module_name} -entry {entry_point} "
f"-c ./tests/config/nextflow.config -c ./tests/modules/{self.org}/{self.module_name}/nextflow.config"
)
if self.no_prompts:
ep_test["command"] = default_val
Expand Down
8 changes: 6 additions & 2 deletions nf_core/subworkflows/test_yml_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,14 @@ def __init__(
test_yml_output_path=None,
force_overwrite=False,
no_prompts=False,
remote_url=None,
branch=None,
):
super().__init__("subworkflows", directory)
self.dir = directory
self.subworkflow = subworkflow
self.remote_url = remote_url
self.branch = branch
self.run_tests = run_tests
self.test_yml_output_path = test_yml_output_path
self.force_overwrite = force_overwrite
Expand All @@ -55,7 +59,7 @@ def __init__(
self.entry_points = []
self.tests = []
self.errors = []
self.modules_repo = ModulesRepo()
self.modules_repo = ModulesRepo(remote_url=self.remote_url, branch=self.branch)
self.modules_json = ModulesJson(self.dir)

def run(self):
Expand All @@ -78,7 +82,7 @@ def check_inputs(self):
if self.subworkflow is None:
self.subworkflow = questionary.autocomplete(
"Subworkflow name:",
choices=self.modules_repo.get_avail_components(self.component_type),
choices=self.components_from_repo(self.org),
style=nf_core.utils.nfcore_question_style,
).unsafe_ask()
self.subworkflow_dir = os.path.join("subworkflows", self.modules_repo.repo_path, self.subworkflow)
Expand Down
5 changes: 3 additions & 2 deletions tests/modules/create_test_yml.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import os
from pathlib import Path

import pytest

import nf_core.modules

from ..utils import with_temporary_folder
from ..utils import GITLAB_DEFAULT_BRANCH, GITLAB_URL, with_temporary_folder


@with_temporary_folder
Expand All @@ -20,7 +21,7 @@ def test_modules_custom_yml_dumper(self, out_dir):

@with_temporary_folder
def test_modules_test_file_dict(self, test_file_dir):
"""Creat dict of test files and create md5 sums"""
"""Create dict of test files and create md5 sums"""
meta_builder = nf_core.modules.ModulesTestYmlBuilder("test/tool", self.pipeline_dir, False, "./", False, True)
with open(os.path.join(test_file_dir, "test_file.txt"), "w") as fh:
fh.write("this line is just for testing")
Expand Down