Skip to content

Commit

Permalink
add tests for assume_ready
Browse files Browse the repository at this point in the history
  • Loading branch information
bpinsard committed Mar 19, 2024
1 parent a7686a5 commit 39bada2
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions datalad_container/tests/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,56 @@ def test_extra_inputs(path=None):
]
) == set(runinfo.get("extra_inputs", set()))

@with_tree(
tree={
"container.img": "image file",
"input.txt": "input data"
}
)
def test_assume_ready(path=None):
ds = Dataset(path).create(force=True, **common_kwargs)
ds.containers_add(
"mycontainer",
image="container.img",
call_fmt="echo image={img} cmd={cmd} img_dspath={img_dspath} img_dirpath={img_dirpath} > out.log",
**common_kwargs
)
ds.save(**common_kwargs)
ds.containers_run(
"XXX",
container_name="mycontainer",
assume_ready=['image'],
**common_kwargs)
ok_file_has_content(
os.path.join(ds.repo.path, "out.log"),
"image=container.img",
re_=True,
)
commit_msg = ds.repo.call_git(["show", "--format=%B"])
cmd, runinfo = get_run_info(ds, commit_msg)
assert "container.img" not in runinfo.get("extra_inputs", [])
with pytest.raises(ValueError):
ds.containers_run(
"XXX",
inputs=['input.txt'],
container_name="mycontainer",
assume_ready=['inputsssstypo', 'outputs'],
**common_kwargs)
with pytest.raises(IncompleteResultsError):
ds.containers_run(
"XXX",
inputs=['input.txt'],
outputs=['out.log'],
container_name="mycontainer",
assume_ready=['inputs', 'outputs'],
**common_kwargs)
ds.containers_run(
"XXX",
inputs=['input.txt'],
outputs=['out.log'],
container_name="mycontainer",
assume_ready=['inputs'],
**common_kwargs)

@skip_if_no_network
@with_tree(tree={"subdir": {"in": "innards"}})
Expand Down

0 comments on commit 39bada2

Please sign in to comment.