metrics: pass --precision to _show_metrics (#5839)

* metrics: pass --precision to _show_metrics

* tests: return empty string
This commit is contained in:
Batuhan Taskaya
2021-04-19 17:25:45 +03:00
committed by GitHub
parent 3472cb1a6a
commit a8b7fda5a2
2 changed files with 18 additions and 2 deletions
+1
View File
@@ -95,6 +95,7 @@ class CmdMetricsShow(CmdMetricsBase):
self.args.all_branches,
self.args.all_tags,
self.args.all_commits,
self.args.precision,
)
if table:
logger.info(table)
+17 -2
View File
@@ -111,16 +111,23 @@ def test_metrics_show(dvc, mocker):
"--all-commits",
"target1",
"target2",
"--precision",
"8",
]
)
assert cli_args.func == CmdMetricsShow
cmd = cli_args.func(cli_args)
m = mocker.patch("dvc.repo.metrics.show.show", return_value={})
m1 = mocker.patch("dvc.repo.metrics.show.show", return_value={})
m2 = mocker.patch(
"dvc.command.metrics._show_metrics",
spec=_show_metrics,
return_value="",
)
assert cmd.run() == 0
m.assert_called_once_with(
m1.assert_called_once_with(
cmd.repo,
["target1", "target2"],
recursive=True,
@@ -128,6 +135,14 @@ def test_metrics_show(dvc, mocker):
all_branches=True,
all_commits=True,
)
m2.assert_called_once_with(
{},
markdown=False,
all_tags=True,
all_branches=True,
all_commits=True,
precision=8,
)
def test_metrics_diff_precision():