mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-04-20 17:19:01 +00:00
fix(core): add hotfix for tests stuck on pairing dialog screen
This commit is contained in:
parent
c8eae27951
commit
7f2244d481
@ -1,3 +1,4 @@
|
||||
import time
|
||||
from typing import TYPE_CHECKING
|
||||
from ubinascii import hexlify
|
||||
|
||||
@ -153,6 +154,30 @@ class PairingContext(Context):
|
||||
f"Allow {self.host_name} on {device_name} to pair with this Trezor?"
|
||||
)
|
||||
|
||||
# TODO FIXME
|
||||
# The subsequent code is a hotfix for the following issue:
|
||||
#
|
||||
# 1. `interact` - on line `result = await interact(` - calls `workflow.close_others` and `_button_request`
|
||||
# 2. `workflow.close_others` may result in clearing of `context.CURRENT_CONTEXT`
|
||||
# 3. `_button_request` uses `context.maybe_call` - sending of button request is ommited
|
||||
# when `context.CURRENT_CONTEXT` is `None`
|
||||
# 4. test gets stuck on the pairing dialog screen
|
||||
#
|
||||
# The hotfix performs `workflow.close_others()` and in case of clearing of `context.CURRENT_CONTEXT`, it
|
||||
# is set to a functional value (`self`)
|
||||
|
||||
workflow.close_others()
|
||||
try:
|
||||
_ = context.get_context()
|
||||
except RuntimeError:
|
||||
time.sleep(0.1)
|
||||
context.CURRENT_CONTEXT = self
|
||||
log.debug(
|
||||
__name__,
|
||||
"Hotfix for current context being destroyed by workflow.close_others",
|
||||
)
|
||||
# --- HOTFIX END ---
|
||||
|
||||
result = await interact(
|
||||
trezorui_api.confirm_action(
|
||||
title="Before you continue", action=action_string, description=None
|
||||
|
Loading…
Reference in New Issue
Block a user