1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-04-22 18:19:03 +00:00

fixup! chore(tests): adapt testing framework to session based [no changelog]

This commit is contained in:
Martin Milata 2025-03-14 21:44:45 +01:00 committed by M1nd3r
parent 06408b6112
commit 01b0194387
3 changed files with 14 additions and 5 deletions
python/src/trezorlib
tests

View File

@ -196,6 +196,15 @@ class TrezorClient:
protocol = ProtocolV2Channel(self.transport, self.mapping)
return protocol
def reset_protocol(self):
if self._protocol_version == ProtocolVersion.PROTOCOL_V1:
self.protocol = ProtocolV1Channel(self.transport, self.mapping)
elif self._protocol_version == ProtocolVersion.PROTOCOL_V2:
self.protocol = ProtocolV2Channel(self.transport, self.mapping)
else:
assert False
self._features = None
def is_outdated(self) -> bool:
if self.features.bootloader_mode:
return False

View File

@ -1411,6 +1411,10 @@ class TrezorClientDebugLink(TrezorClient):
self.actual_responses.append(resp)
return resp
def reset_protocol(self):
super().reset_protocol()
self._seedless_session = self.get_seedless_session(new_session=True)
def load_device(
session: "Session",

View File

@ -350,11 +350,7 @@ def _client_unlocked(
# Get a new client
_raw_client = _get_raw_client(request)
_raw_client.protocol = None
_raw_client.__init__(
transport=_raw_client.transport,
auto_interact=_raw_client.debug.allow_interactions,
)
_raw_client.reset_protocol()
if not _raw_client.features.bootloader_mode:
_raw_client.refresh_features()