Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CoverageWarning in tests #76

Open
jhlegarreta opened this issue Jan 26, 2025 · 0 comments
Open

CoverageWarning in tests #76

jhlegarreta opened this issue Jan 26, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@jhlegarreta
Copy link
Contributor

jhlegarreta commented Jan 26, 2025

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.

@jhlegarreta jhlegarreta added the bug Something isn't working label Jan 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant