From 4700f305cd9d18fd630abd06531a74a0279daa30 Mon Sep 17 00:00:00 2001 From: Vasu Jaganath Date: Thu, 27 Jun 2024 11:39:05 -0400 Subject: [PATCH] modify test2D to automate file creation --- cwltool/command_line_tool.py | 6 ++++-- tests/test_2D.py | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/cwltool/command_line_tool.py b/cwltool/command_line_tool.py index 4afd84228c..c4798c0b7d 100644 --- a/cwltool/command_line_tool.py +++ b/cwltool/command_line_tool.py @@ -1497,14 +1497,16 @@ def collect_output( else: def recursively_insert(j_dict: Any, key: Any, val: Any) -> Any: - """Recursively inserts a value into any dictionaries""" + """Recursively insert a value into any dictionary.""" if isinstance(j_dict, List): return [recursively_insert(x, key, val) for x in j_dict] if isinstance(j_dict, Dict): if j_dict.get("class") == "File": j_dict[key] = val else: - return {x: recursively_insert(y, key, val) for x, y in j_dict.items()} + return { + x: recursively_insert(y, key, val) for x, y in j_dict.items() + } return j_dict result = recursively_insert(result, "format", format_field) diff --git a/tests/test_2D.py b/tests/test_2D.py index 305840bb91..fafddef5a0 100644 --- a/tests/test_2D.py +++ b/tests/test_2D.py @@ -1,16 +1,20 @@ import subprocess import sys +from pathlib import Path from .util import get_data def test_output_2D_file_format() -> None: - """Test format tag for 2D output arrays.""" + """A simple test for format tag fix for 2D output arrays.""" + Path("filename.txt").touch() params = [ sys.executable, "-m", "cwltool", + "--cachedir", # just so that the relative path of file works out + "foo", get_data("tests/output_2D_file_format.cwl"), ]