MCPcopy
hub / github.com/treeverse/dvc / test_output_remote

Function test_output_remote

tests/func/test_data_cloud.py:577–619  ·  view source on GitHub ↗
(tmp_dir, dvc, make_remote)

Source from the content-addressed store, hash-verified

575
576
577def test_output_remote(tmp_dir, dvc, make_remote):
578 make_remote("default", default=True)
579 make_remote("for_foo", default=False)
580 make_remote("for_data", default=False)
581
582 tmp_dir.dvc_gen("foo", "foo")
583 tmp_dir.dvc_gen("bar", "bar")
584 tmp_dir.dvc_gen("data", {"one": "one", "two": "two"})
585
586 with (tmp_dir / "foo.dvc").modify() as d:
587 d["outs"][0]["remote"] = "for_foo"
588
589 with (tmp_dir / "data.dvc").modify() as d:
590 d["outs"][0]["remote"] = "for_data"
591
592 dvc.push()
593
594 default = dvc.cloud.get_remote_odb("default")
595 for_foo = dvc.cloud.get_remote_odb("for_foo")
596 for_data = dvc.cloud.get_remote_odb("for_data")
597
598 assert set(default.all()) == {"37b51d194a7513e45b56f6524f2d51f2"}
599 assert set(for_foo.all()) == {"acbd18db4cc2f85cedef654fccc4a4d8"}
600 assert set(for_data.all()) == {
601 "f97c5d29941bfb1b2fdab0874906ab82",
602 "6b18131dc289fd37006705affe961ef8.dir",
603 "b8a9f715dbb64fd5c56e7783c6820a61",
604 }
605
606 clean(["foo", "bar", "data"], dvc)
607
608 assert dvc.pull() == empty_pull | {
609 "added": ["data" + os.sep, "bar", "foo"],
610 "stats": empty_stats | {"fetched": 5, "added": 4},
611 }
612
613 assert set(dvc.cache.local.all()) == {
614 "37b51d194a7513e45b56f6524f2d51f2",
615 "acbd18db4cc2f85cedef654fccc4a4d8",
616 "f97c5d29941bfb1b2fdab0874906ab82",
617 "6b18131dc289fd37006705affe961ef8.dir",
618 "b8a9f715dbb64fd5c56e7783c6820a61",
619 }
620
621
622def test_target_remote(tmp_dir, dvc, make_remote):

Callers

nothing calls this directly

Calls 7

make_remoteFunction · 0.85
dvc_genMethod · 0.80
get_remote_odbMethod · 0.80
cleanFunction · 0.70
modifyMethod · 0.45
pushMethod · 0.45
pullMethod · 0.45

Tested by

no test coverage detected