-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
plots: Pass templates_dir
to match_renderers
.
#7820
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -240,6 +240,36 @@ def test_plots_path_is_quoted_and_resolved_properly( | |
assert expected_url in out | ||
|
||
|
||
def test_should_pass_template_dir(tmp_dir, dvc, mocker, capsys): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Both of these tests are not useful. I'll suggest testing actual behaviour instead if you can or get rid of them. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@skshetry Could you elaborate on why are not useful?
Behavior is tested in https://github.com/iterative/dvc-render/blob/main/tests/test_templates.py#L39 |
||
cli_args = parse_args( | ||
[ | ||
"plots", | ||
"diff", | ||
"HEAD~1", | ||
"--json", | ||
"--targets", | ||
"plot.csv", | ||
] | ||
) | ||
cmd = cli_args.func(cli_args) | ||
|
||
data = mocker.MagicMock() | ||
mocker.patch("dvc.repo.plots.diff.diff", return_value=data) | ||
|
||
renderers = mocker.MagicMock() | ||
match_renderers = mocker.patch( | ||
"dvc.render.match.match_renderers", return_value=renderers | ||
) | ||
|
||
assert cmd.run() == 0 | ||
|
||
match_renderers.assert_called_once_with( | ||
plots_data=data, | ||
out="dvc_plots", | ||
templates_dir=str(tmp_dir / ".dvc/plots"), | ||
) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"output", ("some_out", os.path.join("to", "subdir"), None) | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, it'd be better to push more of this logic inside the API so that you can test them easily.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for my lack of understanding, could you elaborate on what does "the API" refers to?