What changed, and why it matters
This commit only changes test infrastructure. It replaces the garbage collector's collect() function with a no-op during automated tests so the test suite runs faster. It does not change any code that runs on real Krux devices or affect how user funds or data are handled.
No security action needed. This is a test-only performance optimization. If reviewing for correctness, verify that tests relying on gc.collect explicitly patch it themselves as noted in the fixture docstring.
Security signals we found
No strong security signals were identified.
Evidence from the diff
A new autouse pytest fixture in tests/conftest.py monkeypatches gc.collect to lambda *args: 0 for the test session. The stated purpose is performance: Krux calls gc.collect() frequently on a MicroPython device with a small heap, but under CPython tests it wastes time walking a large heap of mocks. The fixture is explicitly designed to be overridden by any test that needs to assert on gc.collect behavior. The uv.lock change bumps an editable vendored embit reference from 0.8.0 to 0.8.1, which is unrelated to the gc change and not described in the commit.
Changed components
tests/conftest.pyInspect captured patch +13 / −1
diff --git a/tests/conftest.py b/tests/conftest.py
index 03e2c66..729b639 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -38,6 +38,18 @@ def reset_krux_modules():
del sys.modules[name]
+@pytest.fixture(autouse=True)
+def no_gc_collect(monkeypatch):
+ """Krux calls gc.collect() often to manage the device's small heap.
+ On CPython each call walks the much bigger test heap (mostly mock objects)
+ and does nothing useful, costing about a third of the suite runtime.
+ Tests that assert on gc.collect patch it themselves, over this one.
+ """
+ import gc
+
+ monkeypatch.setattr(gc, "collect", lambda *args: 0)
+
+
@pytest.fixture
def mp_modules(mocker, monkeypatch):
from embit.util import secp256k1
diff --git a/uv.lock b/uv.lock
index b06e0b2..1f2cfd2 100644
--- a/uv.lock
+++ b/uv.lock
@@ -183,7 +183,7 @@ wheels = [
[[package]]
name = "embit"
-version = "0.8.0"
+version = "0.8.1"
source = { editable = "vendor/embit" }
[package.metadata]
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.