Skip to content

[BUG] Shared utility module fails in coverage analysis #7872

Open

Description

@scoder

Describe the bug

When enabling coverage analysis in a package compiled with the shared utility module, coverage.py complains that it cannot find the module source:

  File "/opt/hostedtoolcache/Python/3.12.13/x64/lib/python3.12/site-packages/coverage/python.py", line 67, in get_python_source
    raise NoSource(f"No source for code: '{filename}'.", slug="no-source")
coverage.exceptions.NoSource: No source for code: '/home/runner/work/cython/cython/Cython/_shared.pyx'.

Code to reproduce the behaviour:

No response

Expected behaviour

In general, it is unlikely that users care about the shared utility module when it comes to coverage analysis.

Possible ideas:

  • The shared module could be ignored in general, but it might be difficult to detect.
  • All modules for which the source code cannot be found could be marked as excluded, but that might also impact user modules.
  • Require users to exclude the module themselves in their coverage config.

OS

No response

Python version

No response

Cython version

master

Additional context

No response

Activity

  1. matusvalo commented on Jul 30, 2026

    @matusvalo
    Contributor

    Possible ideas:

    Or just simple discourage users in documentation that shared utility is not good for development and running tests?

  2. scoder commented on Jul 31, 2026

    @scoder
    ContributorAuthor

    documentation that shared utility is not good for development and running tests

    I'd rather not require users to make their build configurable so that they can build with and without the shared module.
    I think excluding it in the coverage config is bad enough, it shouldn't be worse than that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions