mne-tools/mne-icalabel

Improve test coverage

adam2392 opened this issue · 6 comments

Looks like the main parts to improve are annotations submodule. We should also ignore the commands submodule probably. I think getting those two fixed should bring our test coverage to 90+

Screen Shot 2022-08-05 at 11 01 22 AM

The display is a bit miss-leading here, the commands module is already ignored:

mne-icalabel/pyproject.toml

Lines 168 to 178 in a09dddc

[tool.coverage.run]
branch = true
cover_pylib = false
source = [
'mne_icalabel',
]
omit = [
'**/__init__.py',
'mne_icalabel/commands/*',
'**/tests/**',
]

It was added as part of #88

And you need to click on commands to 'see' that it's ignored:

Screenshot 2022-08-05 at 17 05 55

If you remove the module from the omit argument, instead of a white square it will show 0%.

Now, codecov reports 89.71%. There is definitely a configuration issue, the 93.31% I was getting via pytest --cov-report term-missing --cov=mne_icalabel mne_icalabel made more sense.

image

Hmm must be something fishy w/ codecov itself then. It seems like its somehow caching the commands/ submodule, when we told it to omit it.

Yes exactly.. The configuration in pyproject.toml is:

[tool.coverage.run]
branch = true
cover_pylib = false
source = [
    'mne_icalabel',
]
omit = [
    '**/__init__.py',
    'mne_icalabel/commands/*',
    'mne_icalabel/_version.py',
    '**/tests/**',
]

[tool.coverage.report]
exclude_lines = [
    'pragma: no cover',
    'if __name__ == .__main__.:',
]
precision = 2

And there is actually an omit argument for [tool.coverage.report] as well. I did try it in one of the commits of #94 and it did not change anything as far as Codecov is concerned. I did not find any configuration set for Codecov, neither at the repository or at the organization level that could explain it.

New configuration is handling this better. Coverage at 91.63%.

Screenshot from 2023-10-27 15-19-20

Closing, feel free to re-open if you want to keep this open for the annotation module.