tests/ui_tests: use separate temporary directories for test cases

pull/971/head
matejcik 4 years ago committed by matejcik
parent 4bc865794f
commit 35a0ae1d18

@ -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"

Loading…
Cancel
Save