Skip to content

plots/metrics: fix some communication disrepancies#4837

Merged
efiop merged 4 commits into
treeverse:masterfrom
pared:4446_malformed_parse
Nov 7, 2020
Merged

plots/metrics: fix some communication disrepancies#4837
efiop merged 4 commits into
treeverse:masterfrom
pared:4446_malformed_parse

Conversation

@pared
Copy link
Copy Markdown
Contributor

@pared pared commented Nov 3, 2020

Thank you for the contribution - we'll try to review it as soon as possible. 🙏

Related to #4446

@pared pared force-pushed the 4446_malformed_parse branch from e995b29 to 896a49c Compare November 3, 2020 16:19
Copy link
Copy Markdown
Contributor Author

@pared pared left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed tests have been checking the type of error thrown. Considering the whole unification issue from the user perspective, it makes more sense to me to check whether interaction with the user is properly structured, and not whether the proper exception type has been thrown. That is why I decided to use main in test_common tests and check for particular error messages in caplog.

Comment on lines -10 to -14
def test_show_empty(dvc):
with pytest.raises(NoMetricsError):
dvc.metrics.show()


Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to test_common.py::test_show_no_metrics_files

Comment on lines -401 to -405
def test_no_plots(tmp_dir, dvc):
from dvc.exceptions import NoPlotsError

with pytest.raises(NoPlotsError):
dvc.plots.show()
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to test_common.py::test_show_no_metrics_files

Comment on lines -39 to -45
def test_show_invalid_metric(tmp_dir, dvc, run_copy_metrics):
tmp_dir.gen("metrics_temp.yaml", "foo:\n- bar\n- baz\nxyz: string")
run_copy_metrics(
"metrics_temp.yaml", "metrics.yaml", metrics=["metrics.yaml"]
)
with pytest.raises(NoMetricsError):
dvc.metrics.show()
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to test_common.py::test_show_malformed_metric.

@pared pared changed the title [WIP] plots/metrics: fix some communication disrepancies plots/metrics: fix some communication disrepancies Nov 3, 2020
@pared pared requested review from efiop, pmrowla and skshetry and removed request for efiop November 3, 2020 17:03
@efiop efiop merged commit f4ee0e1 into treeverse:master Nov 7, 2020
Comment thread dvc/command/plots.py

except DvcException:
logger.exception("")
logger.exception("failed to show plots")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for a post-merge review, but we are going away from these obvious messages and deleting them everywhere. Are you sure we need it here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not necessarily, I added it only to make it consistent with metrics - I guess we could remove it in both places. How about that?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pared Yeah, better to remove in both cases.

Comment on lines +54 to +58
assert (
f"No {command} files in this repository. "
f"Use `{run_options}` options for "
f"`dvc run` to mark stage outputs as {command}."
) in caplog.text
Copy link
Copy Markdown
Contributor

@efiop efiop Nov 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is really an exception that you are testing, it would be better to test it without going through CLI, as we did before. Just a bit cleaner. Same with tests above.

@skshetry skshetry added refactoring Factoring and re-factoring skip-changelog Skips changelog labels Nov 12, 2020
@pared pared mentioned this pull request Dec 18, 2020
2 tasks
@pared pared deleted the 4446_malformed_parse branch January 4, 2022 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactoring Factoring and re-factoring skip-changelog Skips changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants