Skip to content

Commit

Permalink
add pytest for loadContents File[]
Browse files Browse the repository at this point in the history
  • Loading branch information
fmigneault committed Aug 27, 2024
1 parent feeb0be commit 23c5ce0
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Generated during tests
pytestdebug.log
tmp/
*.sif
involucro

# Python temps
__pycache__/
Expand Down Expand Up @@ -59,4 +61,3 @@ cwltool/_version.py
cwltool_deps
docs/_build/
docs/autoapi/

20 changes: 20 additions & 0 deletions tests/test_load_contents.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"""Test the loadContents feature."""
import json
from pathlib import Path

from cwltool.main import main

from .util import get_data


def test_load_contents_file_array(tmp_path: Path) -> None:
"""Ensures that a File[] input with loadContents loads each file."""
params = [
"--outdir", str(tmp_path),
get_data("tests/load_contents-array.cwl"),
"tests/load_contents-array.yml",
]
assert main(params) == 0
with open(tmp_path / "data.json") as out_fd:
data = json.load(out_fd)
assert data == {"data": [1, 2]}

0 comments on commit 23c5ce0

Please sign in to comment.