| 758 | |
| 759 | |
| 760 | def 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) |