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

Function test_partial_remove

dvc/testing/benchmarks/cli/stories/test_modify_data.py:38–56  ·  view source on GitHub ↗
(bench_dvc, tmp_dir, dvc, dataset, remote)

Source from the content-addressed store, hash-verified

36
37@pytest.mark.skipif(sys.version_info < (3, 10), reason="requires 3.10 glob.glob")
38def test_partial_remove(bench_dvc, tmp_dir, dvc, dataset, remote):
39 random.seed(5232)
40 # Add/push full dataset
41 bench_dvc("add", dataset)
42 bench_dvc("push")
43
44 # Remove some files
45 for f in glob.glob("*", root_dir=dataset, recursive=True): # type: ignore[call-arg]
46 if random.random() > 0.5: # noqa: S311
47 if os.path.isfile(dataset / f):
48 os.remove(dataset / f)
49 elif os.path.isdir(dataset / f):
50 shutil.rmtree(dataset / f)
51
52 # Benchmark operations for removing files from dataset
53 bench_dvc("add", dataset, name="update")
54 bench_dvc("push", name="update")
55 bench_dvc("gc", "-f", "-w")
56 bench_dvc("gc", "-f", "-w", "-c", name="cloud")

Callers

nothing calls this directly

Calls 4

bench_dvcFunction · 0.85
isfileMethod · 0.80
isdirMethod · 0.80
removeMethod · 0.45

Tested by

no test coverage detected