diff --git a/tests/ui_tests/reporting/__main__.py b/tests/ui_tests/reporting/__main__.py index f9aac4bfde..de68867697 100644 --- a/tests/ui_tests/reporting/__main__.py +++ b/tests/ui_tests/reporting/__main__.py @@ -9,8 +9,9 @@ def cli(): @cli.command(name="master-diff") -def do_master_diff(): - master_diff.main() +@click.argument("models", nargs=-1) +def do_master_diff(models: list[str] | None = None): + master_diff.main(models=models) if __name__ == "__main__": diff --git a/tests/ui_tests/reporting/common.py b/tests/ui_tests/reporting/common.py index 6001d333d9..195db90b42 100644 --- a/tests/ui_tests/reporting/common.py +++ b/tests/ui_tests/reporting/common.py @@ -36,7 +36,9 @@ def generate_master_diff_report( def get_diff( - current: FixturesType, print_to_console: bool = False + current: FixturesType, + print_to_console: bool = False, + models: list[str] | None = None, ) -> tuple[dict[str, str], dict[str, str], dict[str, tuple[str, str]]]: master = _get_preprocessed_master_fixtures() @@ -45,6 +47,9 @@ def get_diff( diff = {} for model in master.keys() | current.keys(): + if models and model not in models: + continue + master_groups = master.get(model, {}) current_groups = current.get(model, {}) for group in master_groups.keys() | current_groups.keys(): diff --git a/tests/ui_tests/reporting/master_diff.py b/tests/ui_tests/reporting/master_diff.py index 8755cfbc3f..1232888486 100644 --- a/tests/ui_tests/reporting/master_diff.py +++ b/tests/ui_tests/reporting/master_diff.py @@ -104,9 +104,11 @@ def create_dirs() -> None: IMAGES_PATH.mkdir(exist_ok=True) -def create_reports() -> None: +def create_reports(models: list[str] | None = None) -> None: current = get_current_fixtures() - removed_tests, added_tests, diff_tests = get_diff(current, print_to_console=True) + removed_tests, added_tests, diff_tests = get_diff( + current, print_to_console=True, models=models + ) @contextmanager def tmpdir(): @@ -131,8 +133,8 @@ def create_reports() -> None: generate_master_diff_report(diff_tests, MASTERDIFF_PATH) -def main() -> None: +def main(models: list[str] | None = None) -> None: create_dirs() html.set_image_dir(IMAGES_PATH) - create_reports() + create_reports(models) index()