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

Method test_import_url_to_remote_file

dvc/testing/workspace_tests.py:335–355  ·  view source on GitHub ↗
(self, tmp_dir, dvc, workspace, remote)

Source from the content-addressed store, hash-verified

333 assert meta.size == len("foo")
334
335 def test_import_url_to_remote_file(self, tmp_dir, dvc, workspace, remote):
336 workspace.gen("foo", "foo")
337
338 url = "remote://workspace/foo"
339 stage = dvc.imp_url(url, to_remote=True)
340
341 assert stage.deps[0].hash_info.value is not None
342 assert not (tmp_dir / "foo").exists()
343 assert (tmp_dir / "foo.dvc").exists()
344
345 assert len(stage.deps) == 1
346 assert stage.deps[0].def_path == url
347 assert len(stage.outs) == 1
348
349 hash_info = stage.outs[0].hash_info
350 assert hash_info.name == "md5"
351 assert hash_info.value == "acbd18db4cc2f85cedef654fccc4a4d8"
352 assert (
353 remote / "files" / "md5" / "ac" / "bd18db4cc2f85cedef654fccc4a4d8"
354 ).read_text() == "foo"
355 assert stage.outs[0].meta.size == len("foo")
356
357 def test_import_url_to_remote_dir(self, tmp_dir, dvc, workspace, remote):
358 import json

Callers

nothing calls this directly

Calls 3

genMethod · 0.45
existsMethod · 0.45
read_textMethod · 0.45

Tested by

no test coverage detected