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

Method test_deletion

dvc/testing/remote_tests.py:342–369  ·  view source on GitHub ↗
(self, tmp_dir, dvc, scm, remote_worktree)

Source from the content-addressed store, hash-verified

340 ).read_text() == "data_sub"
341
342 def test_deletion(self, tmp_dir, dvc, scm, remote_worktree):
343 tmp_dir.dvc_gen(
344 {
345 "data_dir": {
346 "data_sub_dir": {"data_sub": "data_sub"},
347 "data": "data",
348 "empty": "",
349 }
350 }
351 )
352 dvc.push()
353 assert (remote_worktree / "data_dir" / "data").exists()
354 tmp_dir.scm_add([tmp_dir / "data_dir.dvc"], commit="v1")
355 v1 = scm.get_rev()
356 remove(tmp_dir / "data_dir" / "data")
357 dvc.add(str(tmp_dir / "data_dir"))
358
359 # data_dir/data should show as deleted in the remote
360 dvc.push()
361 tmp_dir.scm_add([tmp_dir / "data_dir.dvc"], commit="v2")
362 assert not (remote_worktree / "data_dir" / "data").exists()
363
364 remove(dvc.cache.local.path)
365 remove(tmp_dir / "data_dir")
366 # pulling the original pushed version should still succeed
367 scm.checkout(v1)
368 dvc.pull()
369 assert (tmp_dir / "data_dir" / "data").read_text() == "data"
370
371 def test_update(self, tmp_dir, dvc, remote_worktree):
372 (foo_stage,) = tmp_dir.dvc_gen("foo", "foo")

Callers

nothing calls this directly

Calls 10

removeFunction · 0.90
dvc_genMethod · 0.80
scm_addMethod · 0.80
pushMethod · 0.45
existsMethod · 0.45
get_revMethod · 0.45
addMethod · 0.45
checkoutMethod · 0.45
pullMethod · 0.45
read_textMethod · 0.45

Tested by

no test coverage detected