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

Function test_refs

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

Source from the content-addressed store, hash-verified

236
237
238def test_refs(tmp_dir, scm, dvc):
239 tmp_dir.dvc_gen("file", "first", commit="first version")
240 tmp_dir.dvc_gen("file", "second", commit="second version")
241 tmp_dir.dvc_gen("file", "third", commit="third version")
242
243 HEAD_2 = digest("first") # noqa: N806
244 HEAD_1 = digest("second") # noqa: N806
245 HEAD = digest("third") # noqa: N806
246
247 assert dvc.diff("HEAD~1") == {
248 "added": [],
249 "deleted": [],
250 "modified": [{"path": "file", "hash": {"old": HEAD_1, "new": HEAD}}],
251 "not in cache": [],
252 "renamed": [],
253 }
254
255 assert dvc.diff("HEAD~2", "HEAD~1") == {
256 "added": [],
257 "deleted": [],
258 "modified": [{"path": "file", "hash": {"old": HEAD_2, "new": HEAD_1}}],
259 "not in cache": [],
260 "renamed": [],
261 }
262
263 with pytest.raises(DvcException, match=r"unknown Git revision 'missing'"):
264 dvc.diff("missing")
265
266
267def test_directories(tmp_dir, scm, dvc):

Callers

nothing calls this directly

Calls 3

digestFunction · 0.85
dvc_genMethod · 0.80
diffMethod · 0.45

Tested by

no test coverage detected