1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-21 13:58:08 +00:00

feat(tests): allow for removing missing tests when updating UI fixtures from CI

[no changelog]
This commit is contained in:
grdddj 2023-09-14 12:21:31 +02:00 committed by Jiří Musil
parent e21dd94dd5
commit 8e48f354ab

View File

@ -51,10 +51,12 @@ def _get_current_git_branch() -> str:
help="Not take these jobs",
multiple=True,
)
@click.option("-r", "--remove-missing", is_flag=True, help="Remove missing tests")
def ci(
branch: str | None,
only_jobs: Iterable[str] | None,
exclude_jobs: Iterable[str] | None,
remove_missing: bool,
) -> None:
"""Update fixtures file with results from CI."""
print("Updating from CI...")
@ -89,6 +91,15 @@ def ci(
current_model = current_fixtures.setdefault(model, {})
current_group = current_model.setdefault(group, {}) # type: ignore
if remove_missing:
# get rid of tests that were not run in CI
removed = 0
for key in list(current_group.keys()):
if key not in ui_res_dict[model][group]:
current_group.pop(key)
removed += 1
print(f"Removed {removed} tests.")
differing = 0
for test_name, res in ui_res_dict[model][group].items():
if current_group.get(test_name) != res: