dvc: don't write default values for cache/persist/metric (#3844)

This commit is contained in:
Ruslan Kuprieiev
2020-05-22 02:58:26 +03:00
committed by GitHub
parent 0f16e15453
commit 84712c4acc
2 changed files with 12 additions and 4 deletions
+6 -3
View File
@@ -271,7 +271,8 @@ class BaseOutput:
if self.IS_DEPENDENCY:
return ret
ret[self.PARAM_CACHE] = self.use_cache
if not self.use_cache:
ret[self.PARAM_CACHE] = self.use_cache
if isinstance(self.metric, dict):
if (
@@ -280,12 +281,14 @@ class BaseOutput:
):
del self.metric[self.PARAM_METRIC_XPATH]
ret[self.PARAM_METRIC] = self.metric
if self.metric:
ret[self.PARAM_METRIC] = self.metric
if self.plot:
ret[self.PARAM_PLOT] = self.plot
ret[self.PARAM_PERSIST] = self.persist
if self.persist:
ret[self.PARAM_PERSIST] = self.persist
return ret
+6 -1
View File
@@ -44,7 +44,12 @@ def test_add(tmp_dir, dvc):
assert len(stage.deps) == 0
assert stage.cmd is None
assert stage.outs[0].info["md5"] == md5
assert stage.md5 == "ee343f2482f53efffc109be83cc976ac"
assert stage.md5 == "411854a9fc55b3cebda28704e41b23b3"
assert load_stage_file("foo.dvc") == {
"md5": "411854a9fc55b3cebda28704e41b23b3",
"outs": [{"md5": "acbd18db4cc2f85cedef654fccc4a4d8", "path": "foo"}],
}
def test_add_unicode(tmp_dir, dvc):