diff --git a/src/workflow.py b/src/workflow.py index 5961369e431f3952c394d699c9eb81fb3f4055c4..3e0423240ba6667f808e885709a6ac363fac1256 100644 --- a/src/workflow.py +++ b/src/workflow.py @@ -6,6 +6,7 @@ from . import constant import os import re import json +from pathlib import Path class Workflow: @@ -14,7 +15,13 @@ class Workflow: license = None, creativeWorkStatus = None, authors = None, version = None, keywords = None, producer = None, publisher = None): - self.nextflow_file = Nextflow_File(file, duplicate = duplicate, display_info = display_info) + self.nextflow_file = Nextflow_File( + file, + duplicate=duplicate, + display_info=display_info, + output_dir=output_dir + ) + self.output_dir = Path(output_dir) self.rocrate = None self.name = name self.datePublished = datePublished diff --git a/tests/test_cli.py b/tests/test_cli.py new file mode 100644 index 0000000000000000000000000000000000000000..04db2ce966d32132ac378841734805890bc444a4 --- /dev/null +++ b/tests/test_cli.py @@ -0,0 +1,20 @@ +import pathlib +import unittest +from tempfile import TemporaryDirectory + +from bioflow_insight_cli.main import cli + + +class TestCall(unittest.TestCase): + + def test_cli_works(self): + cli("./wf_test/main.nf", render_graphs=True) + cli("./wf_test/main.nf", render_graphs=False) + + def test_cli_output_considered(self): + with TemporaryDirectory() as my_temp_dir: + my_results = pathlib.Path(my_temp_dir) / "my_results" + self.assertFalse(my_results.exists()) + cli("./wf_test/main.nf", render_graphs=False, output_dir=str(my_results)) + self.assertTrue(my_results.exists(), "Results should be there, output_dir not taken into account") +