tests(core): fix imports in python unit tests
What changed, and why it matters
This commit only cleans up import statements in Python unit test files. It removes redundant imports and switches some files to use a wildcard import from a shared test helper. There is no change to the actual firmware code that runs on Trezor devices, so this cannot affect device security or user funds.
No security action needed. Treat as routine test-code maintenance.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies 12 test files under core/tests/. Changes are limited to removing redundant imports (e.g., from trezor import utils, import unittest) and unifying on from common import * with flake8: noqa: F403,F405 comments. No runtime firmware logic, cryptographic code, or device behavior is altered. The wildcard imports pull names from the project’s test common module, which is a normal test-suite convention.
Changed components
core/tests/test_apps.bitcoin.change_detector.pycore/tests/test_apps.bitcoin.ownership_proof.pycore/tests/test_apps.common.definitions.pycore/tests/test_apps.ethereum.definitions.pycore/tests/test_apps.monero.serializer.pycore/tests/test_apps.thp.credential_manager.pycore/tests/test_apps.thp.paired_cache.pycore/tests/test_storage.pycore/tests/test_trezor.io.fatfs.pycore/tests/test_trezor.io.sdcard.pycore/tests/test_trezor.sdcard.pycore/tests/test_trezor.utils.pyInspect captured patch +11 / −19
diff --git a/core/tests/test_apps.bitcoin.change_detector.py b/core/tests/test_apps.bitcoin.change_detector.py
index 56629207d..46193dbbb 100644
--- a/core/tests/test_apps.bitcoin.change_detector.py
+++ b/core/tests/test_apps.bitcoin.change_detector.py
@@ -1,5 +1,5 @@
-from common import H_, unittest # isort:skip
-from ubinascii import unhexlify
+# flake8: noqa: F403,F405
+from common import * # isort:skip
from trezor.enums import InputScriptType, MultisigPubkeysOrder, OutputScriptType
from trezor.enums.MultisigPubkeysOrder import LEXICOGRAPHIC, PRESERVED
diff --git a/core/tests/test_apps.bitcoin.ownership_proof.py b/core/tests/test_apps.bitcoin.ownership_proof.py
index 8c830d582..f0fe0af0b 100644
--- a/core/tests/test_apps.bitcoin.ownership_proof.py
+++ b/core/tests/test_apps.bitcoin.ownership_proof.py
@@ -1,4 +1,5 @@
-from common import unhexlify, unittest # isort:skip
+# flake8: noqa: F403,F405
+from common import * # isort:skip
from trezor.crypto import bip39
from trezor.enums import InputScriptType
diff --git a/core/tests/test_apps.common.definitions.py b/core/tests/test_apps.common.definitions.py
index 9dcda2ce6..4321ac6c5 100644
--- a/core/tests/test_apps.common.definitions.py
+++ b/core/tests/test_apps.common.definitions.py
@@ -1,10 +1,7 @@
# flake8: noqa: F403,F405
from common import * # isort:skip
-import typing as t
-import unittest
-
-from trezor import utils, wire
+from trezor import wire
if not utils.BITCOIN_ONLY:
diff --git a/core/tests/test_apps.ethereum.definitions.py b/core/tests/test_apps.ethereum.definitions.py
index 02ba5fb3a..1f191cb9f 100644
--- a/core/tests/test_apps.ethereum.definitions.py
+++ b/core/tests/test_apps.ethereum.definitions.py
@@ -4,7 +4,7 @@ from common import * # isort:skip
import typing as t
import unittest
-from trezor import utils, wire
+from trezor import wire
if not utils.BITCOIN_ONLY:
diff --git a/core/tests/test_apps.monero.serializer.py b/core/tests/test_apps.monero.serializer.py
index 9bdaa7c44..2a2ba902f 100644
--- a/core/tests/test_apps.monero.serializer.py
+++ b/core/tests/test_apps.monero.serializer.py
@@ -1,8 +1,6 @@
# flake8: noqa: F403,F405
from common import * # isort:skip
-from trezor import utils
-
if not utils.BITCOIN_ONLY:
from apps.monero.xmr.serialize.int_serialize import dump_uvarint, load_uvarint
from apps.monero.xmr.serialize.readwriter import MemoryReaderWriter
diff --git a/core/tests/test_apps.thp.credential_manager.py b/core/tests/test_apps.thp.credential_manager.py
index fde708a03..f894750d6 100644
--- a/core/tests/test_apps.thp.credential_manager.py
+++ b/core/tests/test_apps.thp.credential_manager.py
@@ -1,6 +1,6 @@
# flake8: noqa: F403,F405
from common import * # isort: skip
-from trezor import config, log, utils
+from trezor import config, log
if utils.USE_THP:
from trezor.messages import ThpCredentialMetadata
diff --git a/core/tests/test_apps.thp.paired_cache.py b/core/tests/test_apps.thp.paired_cache.py
index bc53e6213..de8b52403 100644
--- a/core/tests/test_apps.thp.paired_cache.py
+++ b/core/tests/test_apps.thp.paired_cache.py
@@ -1,6 +1,6 @@
# flake8: noqa: F403,F405
from common import * # isort: skip
-from trezor import config, utils
+from trezor import config
if utils.USE_THP:
from storage.device import get_thp_paired_names
diff --git a/core/tests/test_storage.py b/core/tests/test_storage.py
index 77870e9ad..ec5c88f27 100644
--- a/core/tests/test_storage.py
+++ b/core/tests/test_storage.py
@@ -2,7 +2,7 @@
from common import * # isort:skip
from storage import device
-from trezor import config, utils
+from trezor import config
class TestConfig(unittest.TestCase):
diff --git a/core/tests/test_trezor.io.fatfs.py b/core/tests/test_trezor.io.fatfs.py
index 2467a587f..ec71c37f8 100644
--- a/core/tests/test_trezor.io.fatfs.py
+++ b/core/tests/test_trezor.io.fatfs.py
@@ -1,8 +1,6 @@
# flake8: noqa: F403,F405
from common import * # isort:skip
-from trezor import utils
-
if utils.USE_SD_CARD:
from trezorio import fatfs, sdcard
diff --git a/core/tests/test_trezor.io.sdcard.py b/core/tests/test_trezor.io.sdcard.py
index 7dd9f2b95..4aa6b9771 100644
--- a/core/tests/test_trezor.io.sdcard.py
+++ b/core/tests/test_trezor.io.sdcard.py
@@ -1,7 +1,7 @@
# flake8: noqa: F403,F405
from common import * # isort:skip
-from trezor import io, utils
+from trezor import io
class TestTrezorIoSdcard(unittest.TestCase):
diff --git a/core/tests/test_trezor.sdcard.py b/core/tests/test_trezor.sdcard.py
index 783682e93..678c441d1 100644
--- a/core/tests/test_trezor.sdcard.py
+++ b/core/tests/test_trezor.sdcard.py
@@ -1,7 +1,7 @@
# flake8: noqa: F403,F405
from common import * # isort:skip
-from trezor import io, sdcard, utils
+from trezor import io, sdcard
if utils.USE_SD_CARD:
fatfs = io.fatfs
diff --git a/core/tests/test_trezor.utils.py b/core/tests/test_trezor.utils.py
index c91fba151..8582c6913 100644
--- a/core/tests/test_trezor.utils.py
+++ b/core/tests/test_trezor.utils.py
@@ -1,8 +1,6 @@
# flake8: noqa: F403,F405
from common import * # isort:skip
-from trezor import utils
-
class TestUtils(unittest.TestCase):
def test_chunks(self):
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.