Merge bitcoin/bitcoin#34409: test: use ModuleNotFoundError in interface_ipc.py

905dfdee86d679f8ea31d841bceb77a5724a6b1b test: use ModuleNotFoundError in interface_ipc.py (fanquake)

Pull request description:

  Change this so we catch the case where the capnp shared libs have been updated, and can no-longer be loaded by the Python module, resulting in a skipped test, even though pycapnp is installed. i.e:
  ```bash
  stderr:
  Traceback (most recent call last):
    File "/root/ci_scratch/build/test/functional/interface_ipc.py", line 20, in <module>
      import capnp  # type: ignore[import] # noqa: F401
      ^^^^^^^^^^^^
    File "/usr/local/lib64/python3.14/site-packages/capnp/__init__.py", line 36, in <module>
      from .version import version as __version__
    File "/usr/local/lib64/python3.14/site-packages/capnp/version.py", line 1, in <module>
      from .lib.capnp import _CAPNP_VERSION_MAJOR as LIBCAPNP_VERSION_MAJOR  # noqa: F401
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  ImportError: libcapnpc.so.1.0.1: cannot open shared object file: No such file or directory
  ```

  Failing in this way should make it clear that `pycapnp` needs to be reinstalled/rebuilt.

  If  `pycapnp` is not installed, the test still skips as expected:
  ```bash
  Remaining jobs: [interface_ipc.py]
  1/1 - interface_ipc.py skipped (capnp module not available.)

  TEST             | STATUS    | DURATION

  interface_ipc.py | ○ Skipped | 0 s
  ```

  Fixes: #34016.

ACKs for top commit:
  maflcko:
    lgtm ACK 905dfdee86d679f8ea31d841bceb77a5724a6b1b
  hebasto:
    ACK 905dfdee86d679f8ea31d841bceb77a5724a6b1b, I have reviewed the code and it looks OK. However, I'm [not able](https://github.com/bitcoin/bitcoin/issues/34016#issuecomment-3799532047) to reproduce https://github.com/bitcoin/bitcoin/issues/34016.
  sedited:
    ACK 905dfdee86d679f8ea31d841bceb77a5724a6b1b

Tree-SHA512: 3cedbe8fc51cc18f1c993f7747d20905f3bf94c736db99a9c4090f5823bf8c09dfbc19ef03c573d504dcdfba6ea0f7d088a7f4563b220742c9a441167c04cfd6
This commit is contained in:
merge-script 2026-01-28 19:06:20 +01:00
commit 2dd5e7bb38
No known key found for this signature in database
GPG Key ID: 9B79B45691DB4173

View File

@ -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