Skip to content

Commit

Permalink
Test check_inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
Aratz committed Mar 28, 2023
1 parent f2be2b5 commit a4b0814
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/subworkflows/create_test_yml.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,23 @@ def test_subworkflows_create_test_yml_entry_points(self):
)
meta_builder.scrape_workflow_entry_points()
assert meta_builder.entry_points[0] == f"test_{subworkflow}"


def test_subworkflows_create_test_yml_check_inputs(self):
"""Test the check_inputs() function - raise UserWarning because test.yml exists"""
cwd = os.getcwd()
os.chdir(self.nfcore_modules)
subworkflow = "test_subworkflow"
meta_builder = nf_core.subworkflows.SubworkflowTestYmlBuilder(
subworkflow=f"{subworkflow}",
directory=self.pipeline_dir,
test_yml_output_path="./",
no_prompts=True,
)
meta_builder.subworkflow_test_main = os.path.join(
self.nfcore_modules, "tests", "subworkflows", "nf-core", subworkflow, "main.nf"
)
with pytest.raises(UserWarning) as excinfo:
meta_builder.check_inputs()
os.chdir(cwd)
assert "Test YAML file already exists!" in str(excinfo.value)
1 change: 1 addition & 0 deletions tests/test_subworkflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def tearDown(self):
test_subworkflows_test_file_dict,
test_subworkflows_create_test_yml_get_md5,
test_subworkflows_create_test_yml_entry_points,
test_subworkflows_create_test_yml_check_inputs,
)
from .subworkflows.info import (
test_subworkflows_info_in_modules_repo,
Expand Down

0 comments on commit a4b0814

Please sign in to comment.