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

Fix incorrect local coverage result with package level minimum #547

Closed
andy-maier opened this issue Mar 25, 2020 · 2 comments
Closed

Fix incorrect local coverage result with package level minimum #547

andy-maier opened this issue Mar 25, 2020 · 2 comments

Comments

@andy-maier
Copy link
Contributor

andy-maier commented Mar 25, 2020

One run where that can be seen is on Python 3.8 with minimum package level,
https://travis-ci.org/github/pywbem/pywbemtools/jobs/666994594#L2092:

----------- coverage: platform linux, python 3.8.0-final-0 -----------
Name                                              Stmts   Miss  Cover   Missing
-------------------------------------------------------------------------------
pywbemtools/pywbemcli/__init__.py                    19      0   100%
pywbemtools/pywbemcli/_association_shrub.py         375    220    41%   62, 142, 342, 380, 384, 484, 486, 530-537, 562, 569, 575-576, 580, 584-585, 591, 607, 707, 728, 739-742, 746-747, 764, 766, 792-794, 798, 815, 838, 868, 870-3187
pywbemtools/pywbemcli/_cimvalueformatter.py         184    120    35%   31-32, 40, 118-120, 379, 426-428, 519-8247
pywbemtools/pywbemcli/_click_extensions.py           20      1    95%   31
pywbemtools/pywbemcli/_cmd_class.py                 375    237    37%   571, 736-737, 803, 897-5213
pywbemtools/pywbemcli/_cmd_connection.py            224    114    49%   309, 336, 377, 380, 399, 481-482, 545, 626-1999
pywbemtools/pywbemcli/_cmd_instance.py              540    418    23%   562, 735, 742, 749-751, 758-789, 818, 843, 916, 964, 1014-1017, 1041, 1077, 1084, 1087, 1127, 1138, 1155-1156, 1177-1183, 1236, 1252-11210
pywbemtools/pywbemcli/_cmd_qualifier.py              47     30    36%   311-897
pywbemtools/pywbemcli/_cmd_server.py                190    113    41%   207, 287, 324-325, 360, 480-2409
pywbemtools/pywbemcli/_common.py                    582    179    69%   115, 125-127, 175, 283, 325, 340, 349-350, 396, 403-406, 497-498, 505, 507, 509, 513, 521, 548-549, 671, 673, 709-713, 716-717, 760-764, 768, 772, 774, 779, 808, 838, 840, 842-845, 910, 913, 1033-1059, 1104-1106, 1144, 1168, 1170, 1173, 1188-1194, 1265-1267, 1317, 1325-1326, 1363-1401, 1405-1406, 1422, 1426, 1428, 1433, 1436, 1439, 1459, 1465, 1558, 1561, 1565, 1600, 1619-2881
pywbemtools/pywbemcli/_common_options.py             60     51    15%   287-5749
pywbemtools/pywbemcli/_connection_repository.py     143     71    50%   33, 101-105, 115-116, 122, 153-154, 232, 295, 323-1975
pywbemtools/pywbemcli/_context_obj.py               177     89    50%   63, 212, 239, 257-258, 287, 293, 369-373, 405-411, 421-2134
pywbemtools/pywbemcli/_displaytree.py                37      5    86%   63, 369-375
pywbemtools/pywbemcli/_pywbem_server.py             215    120    44%   56, 119, 141, 252, 254, 322, 387, 430-440, 454-461, 469, 480-483, 496-3053
pywbemtools/pywbemcli/_pywbemcli_operations.py      118     80    32%   309, 345-347, 400-2052
pywbemtools/pywbemcli/_utils.py                      16      7    56%   41, 53, 65-69
pywbemtools/pywbemcli/config.py                      14     12    14%   298-360
pywbemtools/pywbemcli/pywbemcli.py                  372    325    13%   61-62, 318, 333-334, 561, 577-579, 586-588, 593-594, 643, 646-10347
-------------------------------------------------------------------------------
TOTAL                                              3708   2192    41%

One thing that can be seen is that the reported missing line numbers for some files are above the line numbers of the files. For example:

  • pywbemtools/pywbemcli/_association_shrub.py: reports missing lines up to 3187, but has only 870 lines.

For comparison, here is the result of the same PR on python 3.8 with latest package levels,
https://travis-ci.org/github/pywbem/pywbemtools/jobs/666994595#L1978:

----------- coverage: platform linux, python 3.8.0-final-0 -----------
Name                                              Stmts   Miss  Cover   Missing
-------------------------------------------------------------------------------
pywbemtools/pywbemcli/__init__.py                    19      0   100%
pywbemtools/pywbemcli/_association_shrub.py         324     46    86%   62, 142, 291-292, 351, 486, 530-537, 562, 569, 575-576, 580, 584-585, 591, 607, 616-645, 728-730, 792-794, 798, 819, 838
pywbemtools/pywbemcli/_cimvalueformatter.py         110     14    87%   31-32, 40, 118-120, 169-173, 193-197, 426, 494
pywbemtools/pywbemcli/_click_extensions.py           20      1    95%   31
pywbemtools/pywbemcli/_cmd_class.py                 292      9    97%   736-737, 745-746, 800-801, 885, 892-893
pywbemtools/pywbemcli/_cmd_connection.py            191      8    96%   309, 380, 435-441, 481-482, 545
pywbemtools/pywbemcli/_cmd_instance.py              369     35    91%   742, 749-751, 758, 763, 776-781, 789, 818, 843, 874-875, 893-894, 916, 929-931, 964, 1041, 1087, 1118, 1138, 1155-1156, 1177-1178, 1219, 1236, 1250-1251
pywbemtools/pywbemcli/_cmd_qualifier.py              37      0   100%
pywbemtools/pywbemcli/_cmd_server.py                139     19    86%   207, 228-229, 247-248, 265-266, 287, 297-298, 324-325, 357-358, 392-394, 405-406
pywbemtools/pywbemcli/_common.py                    616     71    88%   115, 125-127, 175, 257-260, 283, 288-289, 294-295, 325, 340, 349-350, 403-404, 497, 585-586, 671, 673, 760-764, 768, 774, 808, 813, 899, 924, 1018, 1024-1026, 1032-1033, 1039-1045, 1058-1059, 1105-1106, 1168, 1170, 1188-1194, 1265-1267, 1289, 1317, 1363, 1422, 1426, 1433, 1439, 1459, 1465, 1472, 1558, 1561, 1565
pywbemtools/pywbemcli/_common_options.py             20      0   100%
pywbemtools/pywbemcli/_connection_repository.py     113     19    83%   33, 70, 76, 101-105, 115-116, 122, 153-154, 178-183, 232, 295
pywbemtools/pywbemcli/_context_obj.py               157     35    78%   63, 161, 201-204, 212, 239, 257-260, 265-266, 287, 293, 304, 309, 325-328, 337, 369-373, 405-411, 421-428
pywbemtools/pywbemcli/_displaytree.py                36      1    97%   63
pywbemtools/pywbemcli/_pywbem_server.py             197     17    91%   56, 65, 119, 141, 252, 254, 347, 429-430, 436, 439, 457, 463-466, 479-480
pywbemtools/pywbemcli/_pywbemcli_operations.py       61      2    97%   284, 309
pywbemtools/pywbemcli/_utils.py                      16      7    56%   41, 53, 65-69
pywbemtools/pywbemcli/config.py                      13      0   100%
pywbemtools/pywbemcli/pywbemcli.py                  215     13    94%   61-62, 318, 352-359, 535-536, 565, 575, 586-588
-------------------------------------------------------------------------------
TOTAL                                              2945    297    90%

The same PR on Python 2.7 with minimum(!) package levels reports reasonable coverage and line numbers.

@andy-maier andy-maier self-assigned this Mar 25, 2020
@andy-maier andy-maier added this to the 0.6.0 milestone Mar 25, 2020
@andy-maier andy-maier added roll back needed Roll back into latest fix branch is needed under work and removed roll back needed Roll back into latest fix branch is needed labels Mar 25, 2020
@andy-maier
Copy link
Contributor Author

andy-maier commented Mar 26, 2020

The issue seems to be related to the version of the coverage package. On a local Python 3.8 on MacOS, the issue behaves as follows:

  • PACKAGE_LEVEL=minimum (coverage 4.5): issue shows up
  • PACKAGE_LEVEL=latest (coverage 4.5.4): issue does not show up
  • PACKAGE_LEVEL=latest, coverage downgraded to 4.5: issue shows up
  • PACKAGE_LEVEL=latest, coverage downgraded to 4.5.3: issue does not show up
  • PACKAGE_LEVEL=latest, coverage downgraded to 4.5.2: issue does not show up
  • PACKAGE_LEVEL=latest, coverage downgraded to 4.5.1: issue shows up

This means the issue is caused by the coverage package, and was fixed in coverage 4.5.2
(change log of coverage). The corresponding issue is nedbat/coveragepy#714.

The solution is therefore to increase the minimum version of coverage to 4.5.2.

@andy-maier
Copy link
Contributor Author

Addressed in PR #550 for master.

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

No branches or pull requests

1 participant