Skip to content

Commit

Permalink
verify that import is hashing files
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Berenbaum committed Aug 16, 2024
1 parent fd3b43d commit 9b26549
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/func/test_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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]

0 comments on commit 9b26549

Please sign in to comment.