test: use ModuleNotFoundError in interface_ipc.py #34409

pull fanquake wants to merge 1 commits into bitcoin:master from fanquake:use_module_not_found changing 1 files +1 −1
  1. fanquake commented at 11:58 am on January 26, 2026: member

    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:

     0stderr:
     1Traceback (most recent call last):
     2  File "/root/ci_scratch/build/test/functional/interface_ipc.py", line 20, in <module>
     3    import capnp  # type: ignore[import] # noqa: F401
     4    ^^^^^^^^^^^^
     5  File "/usr/local/lib64/python3.14/site-packages/capnp/__init__.py", line 36, in <module>
     6    from .version import version as __version__
     7  File "/usr/local/lib64/python3.14/site-packages/capnp/version.py", line 1, in <module>
     8    from .lib.capnp import _CAPNP_VERSION_MAJOR as LIBCAPNP_VERSION_MAJOR  # noqa: F401
     9    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    10ImportError: 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:

    0Remaining jobs: [interface_ipc.py]
    11/1 - interface_ipc.py skipped (capnp module not available.)
    2
    3TEST             | STATUS    | DURATION
    4
    5interface_ipc.py | ○ Skipped | 0 s
    

    Fixes: #34016.

  2. test: use ModuleNotFoundError in interface_ipc.py
    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.
    
    Co-authored-by: Ryan Ofsky <ryan@ofsky.org>
    905dfdee86
  3. DrahtBot added the label Tests on Jan 26, 2026
  4. DrahtBot commented at 11:58 am on January 26, 2026: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/34409.

    Reviews

    See the guideline for information on the review process.

    Type Reviewers
    ACK maflcko, hebasto

    If your review is incorrectly listed, please copy-paste <!–meta-tag:bot-skip–> into the comment that the bot should ignore.

  5. maflcko commented at 1:04 pm on January 26, 2026: member

    lgtm ACK 905dfdee86d679f8ea31d841bceb77a5724a6b1b

    I have not tested this.

  6. hebasto approved
  7. hebasto commented at 1:14 pm on January 26, 2026: member
    ACK 905dfdee86d679f8ea31d841bceb77a5724a6b1b, I have reviewed the code and it looks OK. However, I’m not able to reproduce #34016.

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-01-27 06:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me