| 398 | |
| 399 | |
| 400 | def test_pipeline_file_target_ops(tmp_dir, dvc, run_copy, local_remote): |
| 401 | path = local_remote.url |
| 402 | tmp_dir.dvc_gen("foo", "foo") |
| 403 | |
| 404 | tmp_dir.dvc_gen("lorem", "lorem") |
| 405 | run_copy("lorem", "lorem2", name="copy-lorem-lorem2") |
| 406 | |
| 407 | tmp_dir.dvc_gen("ipsum", "ipsum") |
| 408 | run_copy("ipsum", "baz", name="copy-ipsum-baz") |
| 409 | |
| 410 | outs = ["foo", "lorem", "ipsum", "baz", "lorem2"] |
| 411 | |
| 412 | remove(dvc.stage_cache.cache_dir) |
| 413 | |
| 414 | assert dvc.push() == 3 |
| 415 | |
| 416 | outs = ["foo", "lorem", "ipsum", "baz", "lorem2"] |
| 417 | |
| 418 | # each one's a copy of other, hence 3 |
| 419 | assert len(recurse_list_dir(path)) == 3 |
| 420 | |
| 421 | clean(outs, dvc) |
| 422 | assert dvc.pull(["dvc.yaml"]) == empty_pull | { |
| 423 | "added": ["baz", "lorem2"], |
| 424 | "stats": empty_stats | {"fetched": 2, "added": 2}, |
| 425 | } |
| 426 | |
| 427 | clean(outs, dvc) |
| 428 | assert dvc.pull() == empty_pull | { |
| 429 | "added": ["baz", "foo", "ipsum", "lorem", "lorem2"], |
| 430 | "stats": empty_stats | {"fetched": 3, "added": 5}, |
| 431 | } |
| 432 | |
| 433 | # clean everything in remote and push |
| 434 | from dvc.testing.tmp_dir import TmpDir |
| 435 | |
| 436 | clean(TmpDir(path).iterdir()) |
| 437 | assert dvc.push(["dvc.yaml:copy-ipsum-baz"]) == 1 |
| 438 | assert len(recurse_list_dir(path)) == 1 |
| 439 | |
| 440 | clean(TmpDir(path).iterdir()) |
| 441 | assert dvc.push(["dvc.yaml"]) == 2 |
| 442 | assert len(recurse_list_dir(path)) == 2 |
| 443 | |
| 444 | with pytest.raises(StageNotFound): |
| 445 | dvc.push(["dvc.yaml:StageThatDoesNotExist"]) |
| 446 | |
| 447 | with pytest.raises(StageNotFound): |
| 448 | dvc.pull(["dvc.yaml:StageThatDoesNotExist"]) |
| 449 | |
| 450 | |
| 451 | @pytest.mark.parametrize( |