Skip to content

CoverageWarning in tests #76

Open
Open
@jhlegarreta

Description

@jhlegarreta

What happened?

Although code coverage is being reported through codecov, CIs are showing a warning about the coverage.

Previous versions of the package were not raising the warning, e.g.
https://github.com/nipreps/nifreeze/actions/runs/12872267299/job/35887373250#step:11:1030

Additionally, the coverage is not displayed in the CI log.

The addition of the Run notebooks task does not seem to be the culprit here, i.e.
https://github.com/nipreps/nifreeze/actions/runs/12875170186/job/35897165873#step:12:1029

What command did you use?

pytest --doctest-modules --cov nifreeze -n auto --cov-report xml --junitxml=test-results.xml -v src test

What version of the software are you running?

HEAD (happens with any recent version)

How are you running this software?

Local installation ("bare-metal")

Is your data BIDS valid?

Yes

Are you reusing any previously computed results?

No

Please copy and paste any relevant log output.

/home/runner/work/nifreeze/nifreeze/.tox/py312/lib/python3.12/site-packages/coverage/inorout.py:524: CoverageWarning: Module nifreeze was previously imported, but not measured (module-not-measured)
    self.warn(msg, slug="module-not-measured")

Additional information / screenshots

According to the coverage docs:

Module XXX was previously imported, but not measured (module-not-measured)

You asked coverage.py to measure module XXX, but it had already been imported when coverage started. This meant coverage.py couldn’t monitor its execution.

Google shows multiple leads, e.g.
pytest-dev/pytest-cov#437
pytest-dev/pytest-cov#664
https://pytest-cov.readthedocs.io/en/latest/plugins.html#plugin-coverage

But unsure what the solution is here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions