diff --git a/cg/cli/workflow/nallo/base.py b/cg/cli/workflow/nallo/base.py index 794bd8f700..93e8e186ca 100644 --- a/cg/cli/workflow/nallo/base.py +++ b/cg/cli/workflow/nallo/base.py @@ -6,7 +6,7 @@ from cg.cli.utils import CLICK_CONTEXT_SETTINGS -from cg.cli.workflow.nf_analysis import config_case +from cg.cli.workflow.nf_analysis import config_case, run from cg.constants.constants import MetaApis from cg.meta.workflow.analysis import AnalysisAPI @@ -24,3 +24,4 @@ def nallo(context: click.Context) -> None: nallo.add_command(config_case) +nallo.add_command(run) diff --git a/tests/cli/workflow/nf_analysis/test_cli_run.py b/tests/cli/workflow/nf_analysis/test_cli_run.py index 08d28437be..c19e8c0ded 100644 --- a/tests/cli/workflow/nf_analysis/test_cli_run.py +++ b/tests/cli/workflow/nf_analysis/test_cli_run.py @@ -15,7 +15,7 @@ @pytest.mark.parametrize( "workflow", - NEXTFLOW_WORKFLOWS, + NEXTFLOW_WORKFLOWS + [Workflow.NALLO], ) def test_run_without_options(cli_runner: CliRunner, workflow: Workflow, request: FixtureRequest): """Test run command for workflow without options.""" @@ -35,7 +35,7 @@ def test_run_without_options(cli_runner: CliRunner, workflow: Workflow, request: @pytest.mark.parametrize( "workflow", - NEXTFLOW_WORKFLOWS, + NEXTFLOW_WORKFLOWS + [Workflow.NALLO], ) def test_run_with_missing_case( cli_runner: CliRunner, @@ -64,7 +64,7 @@ def test_run_with_missing_case( @pytest.mark.parametrize( "workflow", - NEXTFLOW_WORKFLOWS, + NEXTFLOW_WORKFLOWS + [Workflow.NALLO], ) def test_run_case_without_samples( cli_runner: CliRunner, @@ -94,7 +94,7 @@ def test_run_case_without_samples( @pytest.mark.parametrize( "workflow", - NEXTFLOW_WORKFLOWS, + NEXTFLOW_WORKFLOWS + [Workflow.NALLO], ) def test_run_case_without_config_files( cli_runner: CliRunner, @@ -121,7 +121,7 @@ def test_run_case_without_config_files( @pytest.mark.parametrize( "workflow", - NEXTFLOW_WORKFLOWS, + NEXTFLOW_WORKFLOWS + [Workflow.NALLO], ) def test_run_case_from_start_dry_run( cli_runner: CliRunner, @@ -137,7 +137,7 @@ def test_run_case_from_start_dry_run( case_id: str = request.getfixturevalue(f"{workflow}_case_id") # GIVEN mocked config files - request.getfixturevalue(f"{workflow}_mock_config") + request.getfixturevalue(f"{workflow}_config") # WHEN invoking a command with dry-run specified result = cli_runner.invoke( @@ -155,7 +155,7 @@ def test_run_case_from_start_dry_run( @pytest.mark.parametrize( "workflow", - NEXTFLOW_WORKFLOWS, + NEXTFLOW_WORKFLOWS + [Workflow.NALLO], ) def test_run_case_with_revision_dry_run( cli_runner: CliRunner, @@ -171,7 +171,7 @@ def test_run_case_with_revision_dry_run( case_id: str = request.getfixturevalue(f"{workflow}_case_id") # GIVEN a mocked config - request.getfixturevalue(f"{workflow}_mock_config") + request.getfixturevalue(f"{workflow}_config") # WHEN invoking a command with dry-run and revision specified result = cli_runner.invoke( @@ -189,7 +189,7 @@ def test_run_case_with_revision_dry_run( @pytest.mark.parametrize( "workflow", - NEXTFLOW_WORKFLOWS, + NEXTFLOW_WORKFLOWS + [Workflow.NALLO], ) def test_resume_case_dry_run( cli_runner: CliRunner, @@ -206,7 +206,7 @@ def test_resume_case_dry_run( case_id: str = request.getfixturevalue(f"{workflow}_case_id") # GIVEN a mocked config - # request.getfixturevalue(f"{workflow}_mock_config") + # request.getfixturevalue(f"{workflow}_config") # WHEN invoking a command with dry-run and nf-tower-id specified result = cli_runner.invoke( @@ -225,13 +225,13 @@ def test_resume_case_dry_run( @pytest.mark.parametrize( "workflow", - NEXTFLOW_WORKFLOWS, + NEXTFLOW_WORKFLOWS + [Workflow.NALLO], ) def test_resume_case_with_missing_tower_id( cli_runner: CliRunner, workflow: Workflow, caplog: LogCaptureFixture, - raredisease_mock_config, + raredisease_config, request: FixtureRequest, ): """Test resume command without providing NF-Tower ID and without existing Trailblazer config file.""" @@ -253,13 +253,13 @@ def test_resume_case_with_missing_tower_id( @pytest.mark.parametrize( "workflow", - NEXTFLOW_WORKFLOWS, + NEXTFLOW_WORKFLOWS + [Workflow.NALLO], ) def test_resume_using_nextflow_dry_run( cli_runner: CliRunner, workflow: Workflow, caplog: LogCaptureFixture, - raredisease_mock_config, + raredisease_config, request: FixtureRequest, ): """Test command with case_id and config file using nextflow.""" diff --git a/tests/conftest.py b/tests/conftest.py index 1a5ea4507e..59dd031208 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -2603,6 +2603,15 @@ def nallo_dir(tmpdir_factory, apps_dir: Path) -> str: return Path(nallo_dir).absolute().as_posix() +@pytest.fixture(scope="function") +def nallo_config(nallo_dir: Path, nallo_case_id: str) -> None: + """Create Nallo samplesheet.csv file for testing""" + Path.mkdir(Path(nallo_dir, nallo_case_id), parents=True, exist_ok=True) + Path(nallo_dir, nallo_case_id, f"{nallo_case_id}_samplesheet").with_suffix( + FileExtensions.CSV + ).touch(exist_ok=True) + + @pytest.fixture(scope="function") def nallo_nexflow_config_file_path(nallo_dir, nallo_case_id) -> Path: """Path to config file.""" @@ -2912,7 +2921,7 @@ def mock_deliverable( @pytest.fixture(scope="function") -def raredisease_mock_config(raredisease_dir: Path, raredisease_case_id: str) -> None: +def raredisease_config(raredisease_dir: Path, raredisease_case_id: str) -> None: """Create samplesheet.csv file for testing""" Path.mkdir(Path(raredisease_dir, raredisease_case_id), parents=True, exist_ok=True) Path(raredisease_dir, raredisease_case_id, f"{raredisease_case_id}_samplesheet").with_suffix( @@ -3434,7 +3443,7 @@ def rnafusion_mock_analysis_finish( @pytest.fixture(scope="function") -def rnafusion_mock_config(rnafusion_dir: Path, rnafusion_case_id: str) -> None: +def rnafusion_config(rnafusion_dir: Path, rnafusion_case_id: str) -> None: """Create samplesheet.csv file for testing""" Path.mkdir(Path(rnafusion_dir, rnafusion_case_id), parents=True, exist_ok=True) Path(rnafusion_dir, rnafusion_case_id, f"{rnafusion_case_id}_samplesheet.csv").with_suffix( @@ -3487,7 +3496,7 @@ def tomte_gene_panel_path(tomte_dir, tomte_case_id) -> Path: @pytest.fixture(scope="function") -def tomte_mock_config(tomte_dir: Path, tomte_case_id: str) -> None: +def tomte_config(tomte_dir: Path, tomte_case_id: str) -> None: """Create Tomte samplesheet.csv file for testing.""" Path.mkdir(Path(tomte_dir, tomte_case_id), parents=True, exist_ok=True) Path(tomte_dir, tomte_case_id, f"{tomte_case_id}_samplesheet").with_suffix( @@ -4093,7 +4102,7 @@ def taxprofiler_mock_analysis_finish( @pytest.fixture(scope="function") -def taxprofiler_mock_config(taxprofiler_dir: Path, taxprofiler_case_id: str) -> None: +def taxprofiler_config(taxprofiler_dir: Path, taxprofiler_case_id: str) -> None: """Create CSV sample sheet file for testing.""" Path.mkdir(Path(taxprofiler_dir, taxprofiler_case_id), parents=True, exist_ok=True) Path(taxprofiler_dir, taxprofiler_case_id, f"{taxprofiler_case_id}_samplesheet").with_suffix(