1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-27 07:40:59 +00:00

tests/ui_tests: use separate temporary directories for test cases

This commit is contained in:
matejcik 2020-05-29 11:52:05 +02:00 committed by matejcik
parent 4bc865794f
commit 35a0ae1d18

View File

@ -1,5 +1,6 @@
import shutil
import tempfile
from contextlib import contextmanager
from pathlib import Path
import dominate
@ -151,10 +152,13 @@ def create_dirs():
def create_reports():
removed_tests, added_tests, diff_tests = get_diff()
@contextmanager
def tmpdir():
with tempfile.TemporaryDirectory(prefix="trezor-records-") as temp_dir:
temp_dir = Path(temp_dir)
yield Path(temp_dir)
for test_name, test_hash in removed_tests.items():
with tmpdir() as temp_dir:
download.fetch_recorded(test_hash, temp_dir)
removed(temp_dir, test_name)
@ -165,7 +169,7 @@ def create_reports():
added(path, test_name)
for test_name, (master_hash, current_hash) in diff_tests.items():
master_screens = temp_dir
with tmpdir() as master_screens:
download.fetch_recorded(master_hash, master_screens)
current_screens = RECORDED_SCREENS_PATH / test_name / "actual"