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

Coverage reporting is broken #935

Open
ogenstad opened this issue Jun 28, 2024 · 0 comments
Open

Coverage reporting is broken #935

ogenstad opened this issue Jun 28, 2024 · 0 comments

Comments

@ogenstad
Copy link
Collaborator

When running the tests the coverage reporting is now broken. In the report below we can see that the overall coverage is 57% where it should be a lot higher, a simple example of where there are problems with the report is in nornir/__init__.py which is reported as having all lines missing. Together with #525 we never spot this issue as the badge displayed within the README file hasn't changed in years.

I think the problem comes from later versions of pytest (and or pytest-cov) and the fact that we have a directory under ./tests called plugins and that pytest tries to load this directory to look for pytest plugins prior to pytest-cov being loaded so coverage never sees the missing lines as they have already been imported.

This needs to be verified but if it's the case a solution would be to either rename the plugins folder under the tests, or to remove pytest-cov and use coverage directly and call pytest from coverage instead of the other way around.

---------- coverage: platform darwin, python 3.12.3-final-0 ----------
Name                                     Stmts   Miss  Cover   Missing
----------------------------------------------------------------------
nornir/__init__.py                           4      4     0%   1-7
nornir/core/__init__.py                     75     36    52%   1-35, 49, 52, 60, 67, 74, 85, 141, 157-161, 167-168, 172-174, 183-191
nornir/core/configuration.py               149     74    50%   1-41, 50, 57-63, 66, 70-81, 95, 104-118, 134, 144, 197-204, 210, 217-223, 226, 232-242, 258-259, 277-278, 306
nornir/core/exceptions.py                   39     34    13%   1-14, 18-48, 51-78, 82, 86-93
nornir/core/filter.py                       76      9    88%   8, 20, 23, 28, 62, 67, 107, 115, 118
nornir/core/helpers/__init__.py              8      8     0%   1-10
nornir/core/helpers/jinja_helper.py         14     14     0%   1-23
nornir/core/inventory.py                   259     93    64%   1-26, 40-50, 60-63, 81-88, 95-96, 102, 115-118, 140-149, 157, 197-200, 220-228, 236-239, 266, 286-294, 301, 305, 309, 316, 324, 330, 336, 354, 368, 371, 374-386, 402, 404, 424, 434, 459, 490, 542, 552, 559-582, 594, 613-616, 627-638
nornir/core/plugins/__init__.py              0      0   100%
nornir/core/plugins/connections.py          10     10     0%   1-35
nornir/core/plugins/inventory.py            12     12     0%   1-29
nornir/core/plugins/register.py             30     16    47%   1-21, 25, 46, 59, 63
nornir/core/plugins/runners.py              11     11     0%   1-24
nornir/core/processor.py                    35     23    34%   1-63, 67, 71, 75, 79, 83
nornir/core/state.py                        12      9    25%   1-15, 19-23, 27-29
nornir/core/task.py                        118     49    58%   1-41, 62, 74, 77, 138, 151-155, 177, 184-207, 233-250, 253, 256-260, 264-284, 288-292, 296-297, 301
nornir/init_nornir.py                       31     11    65%   1-15, 33, 42
nornir/plugins/__init__.py                   0      0   100%
nornir/plugins/connections/__init__.py       0      0   100%
nornir/plugins/functions/__init__.py         0      0   100%
nornir/plugins/inventory/__init__.py         2      0   100%
nornir/plugins/inventory/simple.py          44      1    98%   100
nornir/plugins/processors/__init__.py        0      0   100%
nornir/plugins/runners/__init__.py          26      0   100%
nornir/plugins/tasks/__init__.py             0      0   100%
----------------------------------------------------------------------
TOTAL                                      955    414    57%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant