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

Function test_checkout_relink

tests/func/test_checkout.py:366–387  ·  view source on GitHub ↗
(tmp_dir, dvc, link, link_test_func)

Source from the content-addressed store, hash-verified

364 [("hardlink", system.is_hardlink), ("symlink", system.is_symlink)],
365)
366def test_checkout_relink(tmp_dir, dvc, link, link_test_func):
367 dvc.cache.local.cache_types = [link]
368
369 tmp_dir.dvc_gen({"dir": {"data": "text"}})
370
371 data_file = os.path.join("dir", "data")
372
373 # NOTE: Windows symlink perms don't propagate to the target
374 if not (os.name == "nt" and link == "symlink"):
375 assert not os.access(data_file, os.W_OK)
376
377 dvc.unprotect(data_file)
378 assert os.access(data_file, os.W_OK)
379 assert not link_test_func(data_file)
380
381 assert dvc.checkout(["dir.dvc"], relink=True) == empty_checkout
382 assert link_test_func(data_file)
383
384 # NOTE: Windows symlink perms don't propagate to the target and
385 # hardlink was chmod-ed during relink to be deleted
386 if not (os.name == "nt" and link in ["symlink", "hardlink"]):
387 assert not os.access(data_file, os.W_OK)
388
389
390@pytest.mark.parametrize(

Callers

nothing calls this directly

Calls 4

dvc_genMethod · 0.80
joinMethod · 0.80
unprotectMethod · 0.45
checkoutMethod · 0.45

Tested by

no test coverage detected