mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-12 15:28:21 +01:00
* metrics: include revision information when collecting metrics files * plots: test warning message on no plot on revision * plots/metrics: move to one package, introduce common tests * tests: fix utils placement
30 lines
787 B
Python
30 lines
787 B
Python
import logging
|
|
|
|
import pytest
|
|
|
|
from tests.func.metrics.utils import _write_json
|
|
|
|
|
|
def metrics_diff(dvc, filename, revision):
|
|
dvc.metrics.diff(targets=[filename], a_rev=revision)
|
|
|
|
|
|
def plots_diff(dvc, filename, revision):
|
|
dvc.plots.diff(targets=[filename], revs=[revision])
|
|
|
|
|
|
@pytest.mark.parametrize(
|
|
"diff_fun, metric_value",
|
|
((metrics_diff, {"m": 1}), (plots_diff, [{"m": 1}, {"m": 2}])),
|
|
)
|
|
def test_diff_no_file_on_target_rev(
|
|
tmp_dir, scm, dvc, caplog, diff_fun, metric_value
|
|
):
|
|
with tmp_dir.branch("new_branch", new=True):
|
|
_write_json(tmp_dir, metric_value, "metric.json")
|
|
|
|
with caplog.at_level(logging.WARNING, "dvc"):
|
|
diff_fun(dvc, "metric.json", "master")
|
|
|
|
assert "'metric.json' was not found at: 'master'." in caplog.text
|