metrics: fix diff bt active branch and workspace

This commit is contained in:
dberenbaum
2023-01-09 16:57:18 +02:00
committed by Ruslan Kuprieiev
parent 1d5de9c5ba
commit c6b602a167
2 changed files with 24 additions and 0 deletions
+17
View File
@@ -235,3 +235,20 @@ def test_diff_top_level_metrics(tmp_dir, dvc, scm, dvcfile, metrics_file):
"foo": {"diff": 2, "new": 5, "old": 3}
}
}
def test_metrics_diff_active_branch_unchanged(
tmp_dir, scm, dvc, run_copy_metrics
):
def _gen(val):
metrics = {"a": {"b": {"c": val, "d": 1, "e": str(val)}}}
(tmp_dir / "m_temp.yaml").dump(metrics)
run_copy_metrics(
"m_temp.yaml", "m.yaml", metrics=["m.yaml"], commit=str(val)
)
_gen(1)
_gen(2)
_gen(1)
assert dvc.metrics.diff(a_rev=tmp_dir.scm.active_branch()) == {}