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

fix(tests): ensure the client is open when stopping screen recording

[no changelog]
This commit is contained in:
matejcik 2023-01-19 13:35:19 +01:00 committed by matejcik
parent 9748a56a55
commit 508b6a87e6
2 changed files with 6 additions and 0 deletions

View File

@ -618,6 +618,11 @@ class TrezorClientDebugLink(TrezorClient):
Callable[[protobuf.MessageType], protobuf.MessageType],
] = {}
def ensure_open(self) -> None:
"""Only open session if there isn't already an open one."""
if self.session_counter == 0:
self.open()
def open(self) -> None:
super().open()
if self.session_counter == 1:

View File

@ -153,6 +153,7 @@ def screen_recording(
client.debug.start_recording(str(screen_path))
yield
finally:
client.ensure_open()
# Wait for response to Initialize, which gives the emulator time to catch up
# and redraw the homescreen. Otherwise there's a race condition between that
# and stopping recording.