1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-03-12 22:26:08 +00:00

chore(tests): adapt testing framework to session based

[no changelog]
This commit is contained in:
M1nd3r 2025-02-04 15:13:35 +01:00
parent a028570bd1
commit bdf0cbbdb5

View File

@ -22,6 +22,7 @@ from enum import IntEnum
from pathlib import Path from pathlib import Path
from time import sleep from time import sleep
import cryptography
import pytest import pytest
import xdist import xdist
from _pytest.python import IdMaker from _pytest.python import IdMaker
@ -303,12 +304,17 @@ def _client_unlocked(
should_format = sd_marker.kwargs.get("formatted", True) should_format = sd_marker.kwargs.get("formatted", True)
_raw_client.debug.erase_sd_card(format=should_format) _raw_client.debug.erase_sd_card(format=should_format)
if _raw_client.is_invalidated: while True:
_raw_client = _raw_client.get_new_client() try:
session = _raw_client.get_seedless_session() if _raw_client.is_invalidated:
wipe_device(session) _raw_client = _raw_client.get_new_client()
sleep(1.5) # Makes tests more stable (wait for wipe to finish) session = _raw_client.get_seedless_session()
wipe_device(session)
sleep(1.5) # Makes tests more stable (wait for wipe to finish)
break
except cryptography.exceptions.InvalidTag:
# Get a new client
_raw_client = _get_raw_client(request)
if not _raw_client.features.bootloader_mode: if not _raw_client.features.bootloader_mode:
_raw_client.refresh_features() _raw_client.refresh_features()