mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-04-15 06:45:59 +00:00
chore(tests): add protocol pytest marker
[no changelog]
This commit is contained in:
parent
c214a581c5
commit
3e33022c68
@ -11,6 +11,7 @@ multisig
|
||||
nem
|
||||
ontology
|
||||
peercoin
|
||||
protocol
|
||||
ripple
|
||||
sd_card
|
||||
solana
|
||||
|
@ -30,6 +30,7 @@ from _pytest.python import IdMaker
|
||||
from _pytest.reports import TestReport
|
||||
|
||||
from trezorlib import debuglink, log, messages, models
|
||||
from trezorlib.client import ProtocolVersion
|
||||
from trezorlib.debuglink import TrezorClientDebugLink as Client
|
||||
from trezorlib.device import apply_settings
|
||||
from trezorlib.device import wipe as wipe_device
|
||||
@ -285,6 +286,29 @@ def _client_unlocked(
|
||||
if request.node.get_closest_marker("altcoin") and is_btc_only:
|
||||
pytest.skip("Skipping altcoin test")
|
||||
|
||||
protocol_marker: Mark | None = request.node.get_closest_marker("protocol")
|
||||
if protocol_marker:
|
||||
args = protocol_marker.args
|
||||
protocol_version = _raw_client.protocol_version
|
||||
|
||||
if (
|
||||
protocol_version == ProtocolVersion.PROTOCOL_V1
|
||||
and "protocol_v1" not in args
|
||||
):
|
||||
pytest.skip(
|
||||
f"Skipping test for device/emulator with protocol_v{protocol_version} - the protocol is not supported."
|
||||
)
|
||||
|
||||
if (
|
||||
protocol_version == ProtocolVersion.PROTOCOL_V2
|
||||
and "protocol_v2" not in args
|
||||
):
|
||||
pytest.skip(
|
||||
f"Skipping test for device/emulator with protocol_v{protocol_version} - the protocol is not supported."
|
||||
)
|
||||
|
||||
if _raw_client.protocol_version is ProtocolVersion.PROTOCOL_V2:
|
||||
pass
|
||||
sd_marker = request.node.get_closest_marker("sd_card")
|
||||
if sd_marker and not _raw_client.features.sd_card_present:
|
||||
raise RuntimeError(
|
||||
|
Loading…
Reference in New Issue
Block a user