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 authored and mr-c committed Jul 11, 2024
1 parent 248873f commit 07c162f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 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
30 changes: 14 additions & 16 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,
"-m",
"cwltool",
"--cachedir", # just so that the relative path of file works out
"foo",
get_data("tests/output_2D_file_format.cwl"),
]
tmp_path: Path = tmp_path_factory.mktemp("tmp")
# still need to create 'filename.txt' as it is needed in output_2D_file_format.cwl
_ = tmp_path / "filename.txt"
commands = [
"--cachedir",
str(tmp_path / "foo"), # just so that the relative path of file works out
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 07c162f

Please sign in to comment.