mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-05-07 09:29:04 +00:00
fix(core): add hotfix for tests stuck on pairing dialog screen
This commit is contained in:
parent
a551545737
commit
1727b4f52d
@ -1,3 +1,4 @@
|
|||||||
|
import time
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
from ubinascii import hexlify
|
from ubinascii import hexlify
|
||||||
|
|
||||||
@ -153,6 +154,30 @@ class PairingContext(Context):
|
|||||||
f"Allow {self.host_name} on {device_name} to pair with this Trezor?"
|
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(
|
result = await interact(
|
||||||
trezorui_api.confirm_action(
|
trezorui_api.confirm_action(
|
||||||
title="Before you continue", action=action_string, description=None
|
title="Before you continue", action=action_string, description=None
|
||||||
|
Loading…
Reference in New Issue
Block a user