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

Function test_loads_single_file

tests/func/test_data_cloud.py:760–792  ·  view source on GitHub ↗
(tmp_dir, dvc, local_remote, mocker)

Source from the content-addressed store, hash-verified

758
759
760def test_loads_single_file(tmp_dir, dvc, local_remote, mocker):
761 tmp_dir.dvc_gen("foo", "foo")
762 tmp_dir.dvc_gen("bar", "bar")
763
764 foo_dvcfile = SingleStageFile(dvc, "foo.dvc")
765 bar_dvcfile = SingleStageFile(dvc, "bar.dvc")
766
767 spy = mocker.spy(FileMixin, "_load")
768 assert dvc.push("foo.dvc") == 1
769 spy.assert_called_with(foo_dvcfile)
770 spy.reset_mock()
771
772 assert dvc.push("bar.dvc") == 1
773 spy.assert_called_with(bar_dvcfile)
774 spy.reset_mock()
775
776 dvc.cache.local.clear()
777 (tmp_dir / "bar").unlink()
778 (tmp_dir / "foo").unlink()
779
780 assert dvc.pull("foo.dvc") == {
781 "added": ["foo"],
782 "deleted": [],
783 "modified": [],
784 "stats": {"added": 1, "deleted": 0, "modified": 0, "fetched": 1},
785 }
786 spy.assert_called_with(foo_dvcfile)
787 assert (tmp_dir / "foo").exists()
788 assert not (tmp_dir / "bar").exists()
789 spy.reset_mock()
790
791 assert dvc.fetch("bar.dvc") == 1
792 spy.assert_called_with(bar_dvcfile)

Callers

nothing calls this directly

Calls 8

SingleStageFileClass · 0.90
dvc_genMethod · 0.80
unlinkMethod · 0.80
fetchMethod · 0.80
pushMethod · 0.45
clearMethod · 0.45
pullMethod · 0.45
existsMethod · 0.45

Tested by

no test coverage detected