test(core): remove unused imports from unittests
What changed, and why it matters
This commit only removes unused Python imports and simplifies a few conditional import blocks in unit test files. It does not change any production firmware code, cryptographic logic, or device behavior. There is no security issue here.
No security action needed; this is a routine code-quality/test-maintenance change.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff is a cleanup of five core unit-test files. It deletes unused imports such as from trezor.wire import context, from trezor.wire.codec.codec_context import CodecContext, and import storage.cache_codec, and rewrites some if utils.USE_THP: ... else: ... branches into simpler if not utils.USE_THP: forms. No runtime code paths in the firmware are modified.
Changed components
core/tests/test_apps.bitcoin.approver.pycore/tests/test_apps.bitcoin.authorization.pycore/tests/test_apps.bitcoin.keychain.pycore/tests/test_apps.common.keychain.pycore/tests/test_apps.ethereum.keychain.pyInspect captured patch +3 / −19
diff --git a/core/tests/test_apps.bitcoin.approver.py b/core/tests/test_apps.bitcoin.approver.py
index 1a200a9d..a31fd370 100644
--- a/core/tests/test_apps.bitcoin.approver.py
+++ b/core/tests/test_apps.bitcoin.approver.py
@@ -12,8 +12,6 @@ from trezor.messages import (
TxInput,
TxOutput,
)
-from trezor.wire import context
-from trezor.wire.codec.codec_context import CodecContext
from apps.bitcoin.authorization import FEE_RATE_DECIMALS, CoinJoinAuthorization
from apps.bitcoin.sign_tx.approvers import CoinJoinApprover
diff --git a/core/tests/test_apps.bitcoin.authorization.py b/core/tests/test_apps.bitcoin.authorization.py
index 080b94f6..511c018b 100644
--- a/core/tests/test_apps.bitcoin.authorization.py
+++ b/core/tests/test_apps.bitcoin.authorization.py
@@ -1,21 +1,16 @@
# flake8: noqa: F403,F405
from common import * # isort:skip
-import storage.cache_codec
from trezor.enums import InputScriptType
from trezor.messages import AuthorizeCoinJoin, GetOwnershipProof, SignTx
-from trezor.wire import context
from apps.bitcoin.authorization import CoinJoinAuthorization
from apps.common import coins
_ROUND_ID_LEN = 32
-if utils.USE_THP:
- import thp_common
-else:
+if not utils.USE_THP:
import storage.cache_codec
- from trezor.wire.codec.codec_context import CodecContext
class TestAuthorization(TestCaseWithContext):
diff --git a/core/tests/test_apps.bitcoin.keychain.py b/core/tests/test_apps.bitcoin.keychain.py
index eee605c0..d373583a 100644
--- a/core/tests/test_apps.bitcoin.keychain.py
+++ b/core/tests/test_apps.bitcoin.keychain.py
@@ -5,13 +5,10 @@ from storage import cache_common
from trezor import wire
from trezor.crypto import bip39
from trezor.wire import context
-from trezor.wire.codec.codec_context import CodecContext
from apps.bitcoin.keychain import _get_coin_by_name, _get_keychain_for_coin
-if utils.USE_THP:
- import thp_common
-else:
+if not utils.USE_THP:
from storage import cache_codec
diff --git a/core/tests/test_apps.common.keychain.py b/core/tests/test_apps.common.keychain.py
index e0e8d7fb..106771a5 100644
--- a/core/tests/test_apps.common.keychain.py
+++ b/core/tests/test_apps.common.keychain.py
@@ -7,14 +7,11 @@ from trezor import wire
from trezor.crypto import bip39
from trezor.enums import SafetyCheckLevel
from trezor.wire import context
-from trezor.wire.codec.codec_context import CodecContext
from apps.common import safety_checks
from apps.common.keychain import Keychain, LRUCache, get_keychain, with_slip44_keychain
from apps.common.paths import PATTERN_SEP5, PathSchema
-if utils.USE_THP:
- import thp_common
if not utils.USE_THP:
from storage import cache_codec
diff --git a/core/tests/test_apps.ethereum.keychain.py b/core/tests/test_apps.ethereum.keychain.py
index fd7c06d4..7bc43bbc 100644
--- a/core/tests/test_apps.ethereum.keychain.py
+++ b/core/tests/test_apps.ethereum.keychain.py
@@ -7,14 +7,11 @@ from storage import cache_common
from trezor import wire
from trezor.crypto import bip39
from trezor.wire import context
-from trezor.wire.codec.codec_context import CodecContext
from apps.common.keychain import get_keychain
from apps.common.paths import HARDENED
-if utils.USE_THP:
- import thp_common
-else:
+if not utils.USE_THP:
from storage import cache_codec
Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.