1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-29 01:28:10 +00:00
trezor-firmware/ci/prepare_ui_artifacts.py

30 lines
965 B
Python
Raw Normal View History

2019-12-30 13:09:18 +00:00
import shutil
import sys
2019-12-30 13:09:18 +00:00
from pathlib import Path
ROOT = Path(__file__).resolve().parent.parent
sys.path.insert(0, str(ROOT))
# Needed for setup purposes, filling the FILE_HASHES dict
from tests.ui_tests.common import TestResult, _hash_files # isort:skip
from tests.ui_tests.common import get_current_fixtures # isort:skip
2019-12-30 13:09:18 +00:00
FIXTURES = get_current_fixtures()
2019-12-30 13:09:18 +00:00
for result in TestResult.recent_results():
2023-01-27 14:13:12 +00:00
if not result.passed or result.expected_hash != result.actual_hash:
print("WARNING: skipping failed test", result.test.id)
continue
actual_hash = _hash_files(result.test.actual_dir)
expected_hash = (
FIXTURES.get(result.test.model, {})
.get(result.test.group, {})
.get(result.test.fixtures_name)
)
assert result.expected_hash == actual_hash
2020-01-06 14:44:30 +00:00
assert expected_hash == actual_hash
shutil.make_archive(
2023-01-27 14:13:12 +00:00
str(ROOT / "ci/ui_test_records" / actual_hash), "zip", result.test.actual_dir
)