From 97689cc847f4d13629a17a07ff4e2af336aadc13 Mon Sep 17 00:00:00 2001 From: dberenbaum Date: Wed, 3 Jan 2024 15:55:14 -0500 Subject: [PATCH] tests: pull after imp-url no-download --- tests/func/test_data_cloud.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/func/test_data_cloud.py b/tests/func/test_data_cloud.py index 5e58edf53a5..01845ea3adf 100644 --- a/tests/func/test_data_cloud.py +++ b/tests/func/test_data_cloud.py @@ -277,6 +277,28 @@ def test_pull_partial_import(tmp_dir, dvc, local_workspace): assert stage.outs[0].get_hash().value == "d10b4c3ff123b26dc068d43a8bef2d23" +def test_pull_partial_import_missing(tmp_dir, dvc, local_workspace): + local_workspace.gen("file", "file content") + dst = tmp_dir / "file" + dvc.imp_url("remote://workspace/file", os.fspath(dst), no_download=True) + + (local_workspace / "file").unlink() + with pytest.raises(CheckoutError): + dvc.pull("file") + assert not dst.exists() + + +def test_pull_partial_import_modified(tmp_dir, dvc, local_workspace): + local_workspace.gen("file", "file content") + dst = tmp_dir / "file" + dvc.imp_url("remote://workspace/file", os.fspath(dst), no_download=True) + + local_workspace.gen("file", "updated file content") + with pytest.raises(CheckoutError): + dvc.pull("file") + assert not dst.exists() + + def test_pull_external_dvc_imports_mixed(tmp_dir, dvc, scm, erepo_dir, local_remote): with erepo_dir.chdir(): erepo_dir.dvc_gen("foo", "foo", commit="first")