Skip to content
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/metrics: fix some communication disrepancies #4837

Merged
merged 4 commits into from
Nov 7, 2020

Conversation

pared
Copy link
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
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
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
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
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, skshetry and pmrowla and removed request for efiop November 3, 2020 17:03
@efiop efiop merged commit f4ee0e1 into iterative:master Nov 7, 2020
@@ -73,7 +73,7 @@ def run(self):
)

except DvcException:
logger.exception("")
logger.exception("failed to show plots")
Copy link
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
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
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
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