From 8e48f354ab95706302d69d50b6a8055db57c8fa0 Mon Sep 17 00:00:00 2001 From: grdddj Date: Thu, 14 Sep 2023 12:21:31 +0200 Subject: [PATCH] feat(tests): allow for removing missing tests when updating UI fixtures from CI [no changelog] --- tests/update_fixtures.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/update_fixtures.py b/tests/update_fixtures.py index 335eb56c59..79fe080677 100755 --- a/tests/update_fixtures.py +++ b/tests/update_fixtures.py @@ -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: