render.match: Skip errored revisions in get_files

This commit is contained in:
David de la Iglesia Castro
2022-04-22 16:44:52 +02:00
parent 7708a8e292
commit a394498067
2 changed files with 18 additions and 2 deletions
+6 -2
View File
@@ -10,8 +10,12 @@ if TYPE_CHECKING:
def get_files(plots_data: Dict) -> List:
values = dpath.util.values(plots_data, ["*", "*"])
return sorted({key for submap in values for key in submap.keys()})
files = set()
for rev in plots_data.keys():
for file in plots_data[rev].get("data", {}).keys():
files.add(file)
sorted_files = sorted(files)
return sorted_files
def group_by_filename(plots_data: Dict) -> Dict:
+12
View File
@@ -1,10 +1,22 @@
from dvc.render.match import (
get_files,
group_by_filename,
match_renderers,
squash_plots_properties,
)
def test_get_files_on_error():
plots_data = {
"v2": {"error": "ERROR"},
"v1": {
"data": {"file.json": {"data": [{"y": 2}, {"y": 3}], "props": {}}}
},
}
files = get_files(plots_data)
assert files == ["file.json"]
def test_group_by_filename():
error = FileNotFoundError()
data = {