dvc: rename plot to plots (#3802)

* dvc: rename plot to plots

Follows `dvc params/metrics` convention and is needed in preparation for new
commands and some refactoring.

Part of #3409

* completion: rename plot -> plots
This commit is contained in:
Ruslan Kuprieiev
2020-05-14 22:28:22 +03:00
committed by GitHub
parent ff4fcc937b
commit cec4b4e003
13 changed files with 86 additions and 77 deletions
View File
@@ -10,13 +10,13 @@ import yaml
from bs4 import BeautifulSoup
from funcy import first
from dvc.repo.plot import NoDataOrTemplateProvided
from dvc.repo.plot.data import (
from dvc.repo.plots import NoDataOrTemplateProvided
from dvc.repo.plots.data import (
NoMetricInHistoryError,
PlotData,
PlotMetricTypeError,
)
from dvc.repo.plot.template import (
from dvc.repo.plots.template import (
NoDataForTemplateError,
NoFieldInDataError,
TemplateNotFoundError,
@@ -244,7 +244,7 @@ def test_plot_multiple_revs_default(tmp_dir, scm, dvc):
def test_plot_multiple_revs(tmp_dir, scm, dvc):
shutil.copy(tmp_dir / ".dvc" / "plot" / "default.json", "template.json")
shutil.copy(tmp_dir / ".dvc" / "plots" / "default.json", "template.json")
metric_1 = [{"y": 2}, {"y": 3}]
_write_json(tmp_dir, metric_1, "metric.json")
@@ -324,7 +324,7 @@ def test_throw_on_no_metric_at_all(tmp_dir, scm, dvc, caplog):
def custom_template(tmp_dir, dvc):
custom_template = tmp_dir / "custom_template.json"
shutil.copy(
tmp_dir / ".dvc" / "plot" / "default.json", custom_template,
tmp_dir / ".dvc" / "plots" / "default.json", custom_template,
)
return custom_template
@@ -380,7 +380,7 @@ def test_custom_template_with_specified_data(
def test_plot_override_specified_data_source(tmp_dir, scm, dvc):
shutil.copy(
tmp_dir / ".dvc" / "plot" / "default.json",
tmp_dir / ".dvc" / "plots" / "default.json",
tmp_dir / "newtemplate.json",
)
_replace(
@@ -1,13 +1,13 @@
import pytest
from dvc.cli import parse_args
from dvc.command.plot import CmdPlotDiff, CmdPlotShow
from dvc.command.plots import CmdPlotsDiff, CmdPlotsShow
def test_metrics_diff(mocker):
cli_args = parse_args(
[
"plot",
"plots",
"diff",
"--file",
"result.extension",
@@ -34,7 +34,7 @@ def test_metrics_diff(mocker):
"tag2",
]
)
assert cli_args.func == CmdPlotDiff
assert cli_args.func == CmdPlotsDiff
cmd = cli_args.func(cli_args)
@@ -63,7 +63,7 @@ def test_metrics_diff(mocker):
def test_metrics_show(mocker):
cli_args = parse_args(
[
"plot",
"plots",
"show",
"-f",
"result.extension",
@@ -77,7 +77,7 @@ def test_metrics_show(mocker):
"datafile",
]
)
assert cli_args.func == CmdPlotShow
assert cli_args.func == CmdPlotsShow
cmd = cli_args.func(cli_args)
@@ -115,7 +115,7 @@ def test_metrics_show(mocker):
def test_revisions(mocker, arg_revisions, is_dirty, expected_revisions):
args = mocker.MagicMock()
cmd = CmdPlotDiff(args)
cmd = CmdPlotsDiff(args)
mocker.patch.object(args, "revisions", arg_revisions)
mocker.patch.object(cmd.repo.scm, "is_dirty", return_value=is_dirty)
View File
@@ -2,7 +2,7 @@ from collections import OrderedDict
import pytest
from dvc.repo.plot.data import _apply_path, _find_data, _lists
from dvc.repo.plots.data import _apply_path, _find_data, _lists
@pytest.mark.parametrize(