mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-19 23:11:44 +01:00
dvcfile: preserve 'remote' on add and commit
Preserves 'remote' output on dvc add and dvc commit. Fixes #7356
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import os
|
||||
import textwrap
|
||||
|
||||
import pytest
|
||||
|
||||
@@ -39,6 +40,36 @@ def test_commit_force(tmp_dir, dvc):
|
||||
assert dvc.status([stage.path]) == {}
|
||||
|
||||
|
||||
def test_commit_preserve_fields(tmp_dir, dvc):
|
||||
text = textwrap.dedent(
|
||||
"""\
|
||||
# top comment
|
||||
desc: top desc
|
||||
outs:
|
||||
- path: foo # out comment
|
||||
desc: out desc
|
||||
remote: testremote
|
||||
meta: some metadata
|
||||
"""
|
||||
)
|
||||
tmp_dir.gen("foo.dvc", text)
|
||||
tmp_dir.dvc_gen("foo", "foo", commit=False)
|
||||
dvc.commit("foo")
|
||||
assert (tmp_dir / "foo.dvc").read_text() == textwrap.dedent(
|
||||
"""\
|
||||
# top comment
|
||||
desc: top desc
|
||||
outs:
|
||||
- path: foo # out comment
|
||||
desc: out desc
|
||||
remote: testremote
|
||||
md5: acbd18db4cc2f85cedef654fccc4a4d8
|
||||
size: 3
|
||||
meta: some metadata
|
||||
"""
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("run_kw", [{"single_stage": True}, {"name": "copy"}])
|
||||
def test_commit_with_deps(tmp_dir, dvc, run_copy, run_kw):
|
||||
tmp_dir.gen("foo", "foo")
|
||||
|
||||
Reference in New Issue
Block a user