From 9b26549f158a6fe277447701501dca46adaf6b91 Mon Sep 17 00:00:00 2001 From: Dave Berenbaum Date: Fri, 16 Aug 2024 15:22:16 -0400 Subject: [PATCH] verify that import is hashing files --- tests/func/test_import.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/func/test_import.py b/tests/func/test_import.py index 86e8b3b967..f8e6c105c4 100644 --- a/tests/func/test_import.py +++ b/tests/func/test_import.py @@ -13,6 +13,7 @@ from dvc.stage.exceptions import StagePathNotFoundError from dvc.testing.tmp_dir import make_subrepo from dvc.utils.fs import remove +from dvc_data.hashfile import hash from dvc_data.index.index import DataIndexDirError @@ -736,3 +737,15 @@ def test_reimport(tmp_dir, scm, dvc, erepo_dir, mocker): spy.reset_mock() dvc.imp(os.fspath(erepo_dir), "foo", "foo_imported", force=True) assert not spy.called + + +def test_import_hash(tmp_dir, scm, dvc, erepo_dir, mocker): + with erepo_dir.chdir(): + erepo_dir.dvc_gen("foo", "foo content", commit="create foo") + + spy = mocker.spy(hash, "file_md5") + + dvc.imp(os.fspath(erepo_dir), "foo", "foo_imported") + + out_path = (tmp_dir / "foo_imported").as_posix() + assert out_path == spy.call_args.args[0]