-
Notifications
You must be signed in to change notification settings - Fork 1.2k
metrics: accept any viable target in DvcRepo #4590
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
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 |
---|---|---|
|
@@ -110,3 +110,41 @@ def test_missing_cache(tmp_dir, dvc, run_copy_metrics): | |
remove(stage.outs[0].cache_path) | ||
|
||
assert dvc.metrics.show() == {"": {"metrics.yaml": 1.1}} | ||
|
||
|
||
def test_show_non_metric(tmp_dir, dvc): | ||
tmp_dir.gen("metrics.yaml", "foo: 1.1") | ||
|
||
assert dvc.metrics.show(targets=["metrics.yaml"]) == { | ||
"": {"metrics.yaml": {"foo": 1.1}} | ||
} | ||
|
||
|
||
def test_show_non_metric_branch(tmp_dir, scm, dvc): | ||
tmp_dir.scm_gen("metrics.yaml", "foo: 1.1", commit="init") | ||
with tmp_dir.branch("branch", new=True): | ||
tmp_dir.scm_gen("metrics.yaml", "foo: 2.2", commit="other") | ||
|
||
assert dvc.metrics.show(targets=["metrics.yaml"], revs=["branch"]) == { | ||
"workspace": {"metrics.yaml": {"foo": 1.1}}, | ||
"branch": {"metrics.yaml": {"foo": 2.2}}, | ||
} | ||
|
||
|
||
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. Missing a test for recursive directory with unofficial metrics. 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. Since both official and unofficial metrics are gathered the same way now, I would argue that 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. Thank you! π |
||
def test_non_metric_and_recurisve_show(tmp_dir, dvc, run_copy_metrics): | ||
tmp_dir.gen( | ||
{"metrics_t.yaml": "foo: 1.1", "metrics": {"metric1.yaml": "bar: 1.2"}} | ||
) | ||
|
||
metric2 = os.fspath(tmp_dir / "metrics" / "metric2.yaml") | ||
run_copy_metrics("metrics_t.yaml", metric2, metrics=[metric2]) | ||
|
||
assert dvc.metrics.show( | ||
targets=["metrics_t.yaml", "metrics"], recursive=True | ||
) == { | ||
"": { | ||
os.path.join("metrics", "metric1.yaml"): {"bar": 1.2}, | ||
os.path.join("metrics", "metric2.yaml"): {"foo": 1.1}, | ||
"metrics_t.yaml": {"foo": 1.1}, | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.