From 5ba47b582a4e78ad2c29815e6481ca8728c4aac1 Mon Sep 17 00:00:00 2001 From: grdddj Date: Wed, 9 Feb 2022 13:51:56 +0100 Subject: [PATCH] fix(ci): add T1/TT argument into prepare_ui_artifacts.py to account for missing files --- ci/prepare_ui_artifacts.py | 11 +++++++++-- ci/test.yml | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/ci/prepare_ui_artifacts.py b/ci/prepare_ui_artifacts.py index 9f290c304..0efa556a2 100644 --- a/ci/prepare_ui_artifacts.py +++ b/ci/prepare_ui_artifacts.py @@ -10,10 +10,17 @@ from tests.ui_tests import read_fixtures # isort:skip read_fixtures() from tests.ui_tests import _hash_files, FILE_HASHES, SCREENS_DIR # isort:skip +# As in CI we are running T1 and TT tests separately, there will +# always be the other model missing. +# Therefore, choosing just the cases for our model. +if len(sys.argv) > 1 and sys.argv[1].upper() == "T1": + model = "T1" +else: + model = "TT" +model_file_hashes = {k: v for k, v in FILE_HASHES.items() if k.startswith(f"{model}_")} -for test_case in FILE_HASHES.keys(): +for test_case, expected_hash in model_file_hashes.items(): recorded_dir = SCREENS_DIR / test_case / "recorded" - expected_hash = FILE_HASHES[test_case] actual_hash = _hash_files(recorded_dir) assert expected_hash == actual_hash shutil.make_archive( diff --git a/ci/test.yml b/ci/test.yml index 7af9246de..48a4dbdf4 100644 --- a/ci/test.yml +++ b/ci/test.yml @@ -58,7 +58,7 @@ core device test: - mv core/src/.coverage core/.coverage.test_emu after_script: - mv tests/ui_tests/reporting/reports/test/ test_ui_report - - nix-shell --run "poetry run python ci/prepare_ui_artifacts.py | ts -s" + - nix-shell --run "poetry run python ci/prepare_ui_artifacts.py TT | ts -s" - diff tests/ui_tests/fixtures.json tests/ui_tests/fixtures.suggestion.json artifacts: name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA" @@ -416,7 +416,7 @@ legacy test: - nix-shell --run "poetry run make -C legacy test_emu_ui | ts -s" after_script: - mv tests/ui_tests/reporting/reports/test/ test_ui_report - - nix-shell --run "poetry run python ci/prepare_ui_artifacts.py | ts -s" + - nix-shell --run "poetry run python ci/prepare_ui_artifacts.py T1 | ts -s" - diff tests/ui_tests/fixtures.json tests/ui_tests/fixtures.suggestion.json artifacts: name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA"