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

Function test_commit_preserve_fields

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

Source from the content-addressed store, hash-verified

41
42
43def test_commit_preserve_fields(tmp_dir, dvc):
44 text = textwrap.dedent(
45 """\
46 # top comment
47 desc: top desc
48 outs:
49 - path: foo # out comment
50 desc: out desc
51 type: mytype
52 labels:
53 - label1
54 - label2
55 meta:
56 key1: value1
57 key2: value2
58 remote: testremote
59 hash: md5
60 meta: some metadata
61 """
62 )
63 tmp_dir.gen("foo.dvc", text)
64 tmp_dir.dvc_gen("foo", "foo", commit=False)
65 dvc.commit("foo")
66 assert (tmp_dir / "foo.dvc").read_text() == textwrap.dedent(
67 """\
68 # top comment
69 desc: top desc
70 outs:
71 - path: foo # out comment
72 desc: out desc
73 type: mytype
74 labels:
75 - label1
76 - label2
77 meta:
78 key1: value1
79 key2: value2
80 remote: testremote
81 hash: md5
82 md5: acbd18db4cc2f85cedef654fccc4a4d8
83 size: 3
84 meta: some metadata
85 """
86 )
87
88
89def test_commit_with_deps(tmp_dir, dvc, run_copy):

Callers

nothing calls this directly

Calls 4

dvc_genMethod · 0.80
genMethod · 0.45
commitMethod · 0.45
read_textMethod · 0.45

Tested by

no test coverage detected