test: use ModuleNotFoundError in interface_ipc.py
What changed, and why it matters
This is a tiny change to a single Bitcoin Core test file. It makes the test skip cleanly when the optional capnp Python library is broken or missing, instead of crashing with a confusing error. It does not affect normal Bitcoin node operation, wallets, consensus, networking, or any user-facing security behavior.
No security action needed. Treat as a normal test-quality improvement.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The patch changes the exception handler in test/functional/interface_ipc.py from catching ImportError to catching ModuleNotFoundError. ModuleNotFoundError is a subclass of ImportError raised only when the module itself cannot be found, so a missing pycapnp still skips the test. Other ImportError subclasses—such as the one raised when pycapnp is installed but its native shared-library dependency (libcapnpc.so) is missing—will now propagate and show a clear traceback, helping developers diagnose environment issues. This is purely a test-framework robustness improvement.
Changed components
test/functional/interface_ipc.pyInspect captured patch +1 / −1
diff --git a/test/functional/interface_ipc.py b/test/functional/interface_ipc.py
index c7183c1b..6beba66a 100755
--- a/test/functional/interface_ipc.py
+++ b/test/functional/interface_ipc.py
@@ -42,7 +42,7 @@ class CoinbaseTxData:
# Test may be skipped and not have capnp installed
try:
import capnp # type: ignore[import] # noqa: F401
-except ImportError:
+except ModuleNotFoundError:
pass
@asynccontextmanager
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.