mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-19 23:11:44 +01:00
dvc: change dvcfile.dump to do synchronized dump by default (#4544)
The API of `Dvcfile.dump` has been changed to `dump(stage, update_pipeline=True, update_lock=True)`, which will make it to always dump by default to both files, and provide flags to suppress one or the other. Fixes #4235
This commit is contained in:
@@ -13,6 +13,7 @@ from dvc.stage.exceptions import (
|
||||
StageFileFormatError,
|
||||
StageFileIsNotDvcFileError,
|
||||
)
|
||||
from dvc.utils.fs import remove
|
||||
from dvc.utils.serialize import dump_yaml
|
||||
|
||||
|
||||
@@ -67,15 +68,18 @@ def test_dump_stage(tmp_dir, dvc):
|
||||
)
|
||||
dvcfile = Dvcfile(dvc, "dvc.yaml")
|
||||
|
||||
dvcfile.dump(stage, no_lock=True)
|
||||
dvcfile.dump(stage, update_lock=False, update_pipeline=False)
|
||||
assert not (tmp_dir / PIPELINE_FILE).exists()
|
||||
assert not (tmp_dir / PIPELINE_LOCK).exists()
|
||||
|
||||
dvcfile.dump(stage, no_lock=False)
|
||||
dvcfile.dump(stage, update_pipeline=False)
|
||||
assert not (tmp_dir / PIPELINE_FILE).exists()
|
||||
assert (tmp_dir / PIPELINE_LOCK).exists()
|
||||
assert dvcfile._lockfile.load()
|
||||
|
||||
dvcfile.dump(stage, update_pipeline=True, no_lock=False)
|
||||
remove(tmp_dir / PIPELINE_LOCK)
|
||||
|
||||
dvcfile.dump(stage)
|
||||
assert (tmp_dir / PIPELINE_FILE).exists()
|
||||
assert (tmp_dir / PIPELINE_LOCK).exists()
|
||||
assert list(dvcfile.stages.values()) == [stage]
|
||||
|
||||
Reference in New Issue
Block a user