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

Function test_modified_subrepo

tests/func/test_diff.py:207–235  ·  view source on GitHub ↗
(tmp_dir, scm, dvc)

Source from the content-addressed store, hash-verified

205
206
207def test_modified_subrepo(tmp_dir, scm, dvc):
208 from dvc.repo import Repo
209
210 tmp_dir.gen({"subdir": {"file": "first"}})
211 subrepo_dir = tmp_dir / "subdir"
212
213 with subrepo_dir.chdir():
214 subrepo = Repo.init(subdir=True)
215 subrepo.add("file")
216
217 scm.add(os.path.join("subdir", "file.dvc"))
218 scm.commit("init")
219
220 (subrepo_dir / "file").write_text("second")
221
222 with subrepo_dir.chdir():
223 subrepo = Repo()
224 assert subrepo.diff() == {
225 "added": [],
226 "deleted": [],
227 "modified": [
228 {
229 "path": "file",
230 "hash": {"old": digest("first"), "new": digest("second")},
231 }
232 ],
233 "not in cache": [],
234 "renamed": [],
235 }
236
237
238def test_refs(tmp_dir, scm, dvc):

Callers

nothing calls this directly

Calls 10

RepoClass · 0.90
digestFunction · 0.85
joinMethod · 0.80
write_textMethod · 0.80
genMethod · 0.45
chdirMethod · 0.45
initMethod · 0.45
addMethod · 0.45
commitMethod · 0.45
diffMethod · 0.45

Tested by

no test coverage detected