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

Method test_add_to_remote

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

Source from the content-addressed store, hash-verified

312
313class TestToRemote:
314 def test_add_to_remote(self, tmp_dir, dvc, remote, workspace):
315 workspace.gen("foo", "foo")
316
317 url = "remote://workspace/foo"
318 [stage] = dvc.add(url, to_remote=True)
319
320 assert not (tmp_dir / "foo").exists()
321 assert (tmp_dir / "foo.dvc").exists()
322
323 assert len(stage.deps) == 0
324 assert len(stage.outs) == 1
325
326 hash_info = stage.outs[0].hash_info
327 meta = stage.outs[0].meta
328 assert hash_info.name == "md5"
329 assert hash_info.value == "acbd18db4cc2f85cedef654fccc4a4d8"
330 assert (
331 remote / "files" / "md5" / "ac" / "bd18db4cc2f85cedef654fccc4a4d8"
332 ).read_text() == "foo"
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")

Callers

nothing calls this directly

Calls 4

genMethod · 0.45
addMethod · 0.45
existsMethod · 0.45
read_textMethod · 0.45

Tested by

no test coverage detected