Skip to content

Commit 1f1405f

Browse files
author
Vasu Jaganath
committed
fix for --generate_cwl_workflow and corresponding test
1 parent f46de3e commit 1f1405f

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

src/sophios/main.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,11 @@ def main() -> None:
205205
# we need to copy the output files manually. See comment above.
206206
if args.cwl_runner == 'cwltool' and args.copy_output_files:
207207
run_local.copy_output_files(yaml_stem)
208+
elif args.generate_cwl_workflow:
209+
io.write_to_disk(rose_tree, Path('autogenerated/'), True, args.inputs_file)
210+
else:
211+
print('Please specify either --generate_cwl_workflow (compile) or --run_local (run)')
212+
sys.exit(1)
208213

209214

210215
if __name__ == '__main__':

tests/test_cli_flags.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import pathlib
22
import subprocess
3-
import yaml
43
import shutil
5-
6-
from sophios.main import main
7-
from sophios.cli import get_args
4+
import yaml
85

96

107
def test_generate_cwl_workflow() -> None:
@@ -19,17 +16,16 @@ def test_generate_cwl_workflow() -> None:
1916

2017
yaml_path = str(pathlib.Path(__file__).parent.parent.resolve() / "docs/tutorials/helloworld.wic")
2118

22-
args = ["sophios", "--yaml", yaml_path, "--generate_cwl_workflow"]
19+
cmd = ["sophios", "--yaml", yaml_path, "--generate_cwl_workflow"]
2320

2421
# run sophios with args
25-
subprocess.run(args)
22+
subprocess.run(cmd, check=False)
2623

27-
with open("autogenerated/helloworld.cwl", "r") as cwl_file:
24+
with open("autogenerated/helloworld.cwl", "r", encoding='utf-8') as cwl_file:
2825
result_dict = yaml.safe_load(cwl_file)
2926

30-
with open(
31-
str(pathlib.Path(__file__).parent.resolve() / "data/cwl/helloworld.cwl"), "r"
32-
) as cwl_file:
27+
with open(str(pathlib.Path(__file__).parent.resolve() / "data/cwl/helloworld.cwl"), "r",
28+
encoding='utf-8') as cwl_file:
3329
actual_dict = yaml.safe_load(cwl_file)
3430

3531
assert result_dict == actual_dict

0 commit comments

Comments
 (0)