From 9cdc9ce26a707fdb0b6f433acdc69b41b901b0f2 Mon Sep 17 00:00:00 2001 From: VGPReys Date: Tue, 24 Sep 2024 08:55:19 +0200 Subject: [PATCH 1/3] recipe to workflow --- src/haddock/clis/cli.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/haddock/clis/cli.py b/src/haddock/clis/cli.py index 4b297983c..a3681430c 100755 --- a/src/haddock/clis/cli.py +++ b/src/haddock/clis/cli.py @@ -36,10 +36,13 @@ ap = argparse.ArgumentParser() ap.add_argument( - "recipe", + "workflow", type=arg_file_exist, - help="The input recipe file path", -) + help=( + "The input configuration file path describing " + "the workflow to be performed" + ), + ) add_restart_arg(ap) add_extend_run(ap) @@ -76,7 +79,7 @@ def maincli() -> None: def main( - recipe: FilePath, + workflow: FilePath, restart: Optional[int] = None, extend_run: Optional[FilePath] = EXTEND_RUN_DEFAULT, setup_only: bool = False, @@ -87,8 +90,8 @@ def main( Parameters ---------- - recipe : str or pathlib.Path - The path to the recipe (config file). + workflow : str or pathlib.Path + The path to the workflow (config file). restart : int The step to restart the run from (inclusive). @@ -145,7 +148,7 @@ def main( with log_error_and_exit(): params, other_params = setup_run( - recipe, + workflow, restart_from=restart, extend_run=extend_run, ) From 45027bd7ae9b557100c04ae0d2d09392678507c4 Mon Sep 17 00:00:00 2001 From: VGPReys Date: Tue, 24 Sep 2024 09:15:34 +0200 Subject: [PATCH 2/3] update tests --- tests/test_cli.py | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/tests/test_cli.py b/tests/test_cli.py index 59b6dbe61..a73ea5121 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -8,7 +8,9 @@ from . import configs_data -recipe = Path(configs_data, 'recipe.cfg') +@pytest.fixture(name="workflow") +def fixture_workflow(): + yield Path(configs_data, "workflow.cfg") def test_cli_has_maincli(): @@ -21,33 +23,33 @@ def test_cli_has_maincli(): def test_ap_recipe_does_not_exist(): - """Test raise error if recipe does not exist.""" + """Test raise error if workflow does not exist.""" with pytest.raises(SystemExit) as exit: cli.ap.parse_args('does_not_exit.cfg'.split()) assert exit.type == SystemExit assert exit.value.code == 2 -def test_ap_recipe_exists(): - """Test reading recipes.""" - cmd = cli.ap.parse_args(str(recipe).split()) - with open(cmd.recipe) as fin: +def test_ap_workflow_exists(workflow): + """Test reading workflows.""" + cmd = cli.ap.parse_args(str(workflow).split()) + with open(cmd.workflow) as fin: fin.readlines() -def test_ap_setup_true(): +def test_ap_setup_true(workflow): """Test --setup flag.""" - cmd = cli.ap.parse_args(f'{recipe} --setup'.split()) + cmd = cli.ap.parse_args(f'{workflow} --setup'.split()) assert cmd.setup_only is True -def test_ap_setup_false(): +def test_ap_setup_false(workflow): """Test setup only default.""" - cmd = cli.ap.parse_args(str(recipe).split()) + cmd = cli.ap.parse_args(str(workflow).split()) assert cmd.setup_only is False -def test_ap_version(): +def test_ap_version(workflow): """Test -v version flag.""" with pytest.raises(SystemExit) as exit: cli.ap.parse_args('-v'.split()) @@ -59,15 +61,15 @@ def test_ap_version(): 'level', ("DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"), ) -def test_ap_log_level(level): +def test_ap_log_level(workflow, level): """Test --log-level correct.""" - cmd = cli.ap.parse_args(f'{recipe} --log-level {level}'.split()) + cmd = cli.ap.parse_args(f'{workflow} --log-level {level}'.split()) assert cmd.log_level == level -def test_ap_log_level_error(): +def test_ap_log_level_error(workflow): """Test --log-level error with bad input.""" with pytest.raises(SystemExit) as exit: - cli.ap.parse_args(f'{recipe} --log-level BAD'.split()) + cli.ap.parse_args(f'{workflow} --log-level BAD'.split()) assert exit.type == SystemExit assert exit.value.code == 2 From 1a9df1e7ac138b84648caed80c9a7da65b9b8819 Mon Sep 17 00:00:00 2001 From: VGPReys Date: Tue, 24 Sep 2024 09:36:25 +0200 Subject: [PATCH 3/3] fix filename --- tests/test_cli.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_cli.py b/tests/test_cli.py index a73ea5121..b912dbcf9 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -10,7 +10,7 @@ @pytest.fixture(name="workflow") def fixture_workflow(): - yield Path(configs_data, "workflow.cfg") + yield Path(configs_data, "recipe.cfg") def test_cli_has_maincli(): @@ -49,7 +49,7 @@ def test_ap_setup_false(workflow): assert cmd.setup_only is False -def test_ap_version(workflow): +def test_ap_version(): """Test -v version flag.""" with pytest.raises(SystemExit) as exit: cli.ap.parse_args('-v'.split())