From 52479008688876d10cd8dccf69100c35e78f82dd Mon Sep 17 00:00:00 2001 From: David de la Iglesia Castro Date: Fri, 29 Oct 2021 20:25:25 +0200 Subject: [PATCH] exp diff: Remove `--old` option. After #6814 the header of `diff_table` is `a_rev/`b_rev` instead of `Old`/`New` so the name of the option was counterintuitive. In addition, make `a_rev` show by default, for consistency with output format of other `diff_table` uses (`dvc metrics diff` / `dvc params diff`). --- dvc/command/experiments.py | 7 ------- tests/unit/command/test_experiments.py | 24 +++++++++++++++++++++++- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/dvc/command/experiments.py b/dvc/command/experiments.py index eb136f09ce..b42db276ff 100644 --- a/dvc/command/experiments.py +++ b/dvc/command/experiments.py @@ -583,7 +583,6 @@ def run(self): title=title, markdown=self.args.markdown, no_path=self.args.no_path, - old=self.args.old, on_empty_diff="diff not supported", precision=precision if key == "metrics" else None, a_rev=self.args.a_rev, @@ -1101,12 +1100,6 @@ def add_parser(subparsers, parent_parser): dest="markdown", help="Show tabulated output in the Markdown format (GFM).", ) - experiments_diff_parser.add_argument( - "--old", - action="store_true", - default=False, - help="Show old ('a_rev') metric/param value.", - ) experiments_diff_parser.add_argument( "--no-path", action="store_true", diff --git a/tests/unit/command/test_experiments.py b/tests/unit/command/test_experiments.py index 3b00c47167..8519f8e208 100644 --- a/tests/unit/command/test_experiments.py +++ b/tests/unit/command/test_experiments.py @@ -46,7 +46,6 @@ def test_experiments_diff(dvc, scm, mocker): "--param-deps", "--json", "--md", - "--old", "--precision", "10", ] @@ -63,6 +62,29 @@ def test_experiments_diff(dvc, scm, mocker): ) +def test_experiments_diff_revs(mocker, capsys): + mocker.patch( + "dvc.repo.experiments.diff.diff", + return_value={ + "params": { + "params.yaml": {"foo": {"diff": 1, "old": 1, "new": 2}} + }, + "metrics": { + "metrics.yaml": {"foo": {"diff": 1, "old": 1, "new": 2}} + }, + }, + ) + + cli_args = parse_args(["exp", "diff", "exp_a", "exp_b"]) + cmd = cli_args.func(cli_args) + + capsys.readouterr() + assert cmd.run() == 0 + cap = capsys.readouterr() + assert "exp_a" in cap.out + assert "exp_b" in cap.out + + def test_experiments_show(dvc, scm, mocker): cli_args = parse_args( [