Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Berenbaum authored and dberenbaum committed May 23, 2024
1 parent ebb459f commit 856c902
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/func/repro/test_repro_allow_missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,16 @@ def test_repro_allow_missing_upstream_stage_modified(
ret = dvc.reproduce(pull=True, allow_missing=True)
# create-foo is skipped ; copy-foo pulls modified dep
assert len(ret) == 1


def test_repro_allow_missing_cached(tmp_dir, dvc):
tmp_dir.gen("fixed", "fixed")
dvc.stage.add(name="create-foo", cmd="echo foo > foo", deps=["fixed"], outs=["foo"])
dvc.stage.add(name="copy-foo", cmd="cp foo bar", deps=["foo"], outs=["bar"])
dvc.reproduce()

remove("foo")

ret = dvc.reproduce(allow_missing=True)
# both stages are skipped
assert not ret
13 changes: 13 additions & 0 deletions tests/func/repro/test_repro_pull.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,16 @@ def test_repro_skip_pull_if_single_item_is_passed(tmp_dir, dvc, mocker, local_re
remove(foo.outs[0].cache_path)

assert dvc.reproduce(pull=True, single_item=True)


def test_repro_pulls_persisted_output(tmp_dir, dvc, mocker, local_remote):
tmp_dir.dvc_gen("foo", "foo")

dvc.push()

dvc.stage.add(name="copy-foo", cmd="cp foo bar", deps=["foo"], outs_persist=["bar"])
dvc.reproduce()
remove("bar")

# stage is skipped
assert not dvc.reproduce(pull=True)

0 comments on commit 856c902

Please sign in to comment.