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

Function test_commit_force

tests/func/test_commit.py:24–40  ·  view source on GitHub ↗
(tmp_dir, dvc)

Source from the content-addressed store, hash-verified

22
23
24def test_commit_force(tmp_dir, dvc):
25 tmp_dir.gen({"dir": {"file": "text1", "file2": "text2"}})
26 (stage,) = dvc.add("dir", no_commit=True)
27
28 assert stage.outs[0].changed_cache()
29
30 tmp_dir.gen("dir/file", "file content modified")
31
32 assert stage.outs[0].changed_cache()
33
34 with pytest.raises(StageCommitError):
35 dvc.commit(stage.path)
36
37 assert stage.outs[0].changed_cache()
38
39 dvc.commit(stage.path, force=True)
40 assert dvc.status([stage.path]) == {}
41
42
43def test_commit_preserve_fields(tmp_dir, dvc):

Callers

nothing calls this directly

Calls 5

changed_cacheMethod · 0.80
genMethod · 0.45
addMethod · 0.45
commitMethod · 0.45
statusMethod · 0.45

Tested by

no test coverage detected