Skip to content

Commit

Permalink
try to fix tmp_dir permission failure with test fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
Vasu Jaganath committed Jul 9, 2024
1 parent 6efcc8e commit 56f2841
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
4 changes: 2 additions & 2 deletions cwltool/command_line_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -1498,9 +1498,9 @@ def collect_output(

def recursively_insert(j_dict: Any, key: Any, val: Any) -> Any:
"""Recursively insert a value into any dictionary."""
if isinstance(j_dict, List):
if isinstance(j_dict, MutableSequence):
return [recursively_insert(x, key, val) for x in j_dict]
if isinstance(j_dict, Dict):
if isinstance(j_dict, MutableMapping):
if j_dict.get("class") == "File":
j_dict[key] = val
else:
Expand Down
24 changes: 11 additions & 13 deletions tests/test_2D.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
import subprocess
import sys
from pathlib import Path
import pytest
from .util import get_data, get_main_output

from .util import get_data


def test_output_2D_file_format() -> None:
@pytest.fixture(scope="session")
def test_output_2d_file_format(tmp_path_factory: pytest.TempPathFactory) -> None:
"""A simple test for format tag fix for 2D output arrays."""

Path("filename.txt").touch()
params = [
sys.executable,
tmp_path: Path = tmp_path_factory.mktemp("tmp")
commands = [
"-m",
"cwltool",
"--cachedir", # just so that the relative path of file works out
"foo",
get_data("tests/output_2D_file_format.cwl"),
]
str(tmp_path),
get_data("tests/output_2D_file_format.cwl")]

error_code, _, stderr = get_main_output(commands)

assert subprocess.check_call(params) == 0
assert error_code == 0, stderr

0 comments on commit 56f2841

Please sign in to comment.