From 1530421f316cc540509f5c542c3e48df085c5171 Mon Sep 17 00:00:00 2001 From: highlander Date: Fri, 21 Aug 2026 01:16:40 -0500 Subject: [PATCH] test: gate the bitcoin-only suite on the bitcoin-only product Adds requires_bitcoinOnly(), the inverse of requires_fullFeature(), and applies it in test_msg_bitcoin_only_variant.setUp(). The file describes the BITCOIN-ONLY product, but CI points the pyk suite at the full emulator image, so it ran there too. Most of it passes either way; the OP_RETURN test does not, because on the multi-chain build the same transaction decodes a THORChain memo and draws more screens ([3,3,3,3,3,8] against the bitcoin-only [3,3,8]). That is a category error, not a finding. The guard could not be written until now, and the file's own docstring says so: variant_getName() answered "Emulator" for BOTH products, so a bitcoin-only emulator was indistinguishable from a full one. keepkey-firmware #495 fixed that, and this is the first thing it buys. Measured after the guard: full emulator 620 passed, 33 skipped, 0 failed bitcoin-only emu 11 passed, 0 skipped, 0 failed --- tests/common.py | 13 +++++++++++++ tests/test_msg_bitcoin_only_variant.py | 6 ++++++ 2 files changed, 19 insertions(+) diff --git a/tests/common.py b/tests/common.py index 275ef28d..1ede6f1c 100644 --- a/tests/common.py +++ b/tests/common.py @@ -194,5 +194,18 @@ def requires_fullFeature(self): self.client.features.firmware_variant == "EmulatorBTC": self.skipTest("Full feature firmware required to run this test") + def requires_bitcoinOnly(self): + """Inverse of requires_fullFeature(): skip unless this IS the + bitcoin-only product. + + Usable since the firmware learned to report the variant honestly -- + variant_getName() used to answer "Emulator" for both products, so a + bitcoin-only emulator was indistinguishable from a full one and this + guard could not be written. + """ + if self.client.features.firmware_variant not in ("KeepKeyBTC", + "EmulatorBTC"): + self.skipTest("Bitcoin-only firmware required to run this test") + diff --git a/tests/test_msg_bitcoin_only_variant.py b/tests/test_msg_bitcoin_only_variant.py index 3f8327b9..9b2d14a7 100644 --- a/tests/test_msg_bitcoin_only_variant.py +++ b/tests/test_msg_bitcoin_only_variant.py @@ -100,6 +100,12 @@ class TestBitcoinOnlyVariant(common.KeepKeyTest): def setUp(self): super(TestBitcoinOnlyVariant, self).setUp() self.requires_firmware("7.15.0") + # This whole file describes the BITCOIN-ONLY product. Several tests + # assert screen sequences that differ on the multi-chain build -- the + # OP_RETURN one decodes a THORChain memo there and draws more screens -- + # so running them against a full-feature device is a category error, not + # a finding. CI points the pyk suite at the full emulator image. + self.requires_bitcoinOnly() self.screens = [] # Refuse (press NO) on the Nth ButtonRequest of the current flow; # None means confirm everything.