perrette / papers

Command-line tool to manage bibliography (pdfs + bibtex)
MIT License
142 stars 22 forks source link

Improve test coverage #48

Open perrette opened 1 year ago

perrette commented 1 year ago

We now have about 60% test coverage (test coverage issues were fixed in #44).

Name                  Stmts   Miss  Cover
-----------------------------------------
papers/__init__.py        4      0   100%
papers/__main__.py      520    206    60%
papers/_version.py        2      0   100%
papers/bib.py           492    192    61%
papers/config.py        250     86    66%
papers/duplicate.py     384    136    65%
papers/encoding.py       84     22    74%
papers/extract.py       236    151    36%
papers/filename.py       51      4    92%
papers/latexenc.py       57     36    37%
-----------------------------------------
TOTAL                  2080    833    60%

As a first objective, we should aim for 100% test coverage for __main__.py, i.e. that every sub-command and if/then/else branching is executed at least once. That way we can be sure that namespace, import and other syntax errors ring the bell. From there, we can start thinking about semantic, i.e. thinking about simple and intricate cases where we expect a meaningful result.

The coverage reporting includes a missing lines section that is more informative:

Name                  Stmts   Miss  Cover   Missing
---------------------------------------------------
papers/__init__.py        4      0   100%
papers/__main__.py      520    206    60%   26, 30, 79-87, 103-119, 123-133, 147-149, 152, 171, 177-178, 185-186, 190-204, 215, 219-220, 239, 245-250, 253-260, 271, 306, 318-330, 333-339, 343-347, 356, 360-370, 374, 377, 381-386, 391-496, 499, 510-511, 815, 820-821, 827, 829, 831, 833, 838-842
papers/_version.py        2      0   100%
papers/bib.py           492    192    61%   45-47, 67, 140-143, 157-158, 175-190, 214, 233-234, 237, 262, 273, 332, 371, 381, 388, 401-402, 408, 440-446, 450, 455-459, 469, 505, 513-514, 523, 541, 562-565, 575-580, 590-594, 598-613, 616-629, 633-660, 664-668, 671, 674-682, 686, 692-703, 709-781
papers/config.py        250     86    66%   32-39, 66-67, 94-98, 105, 110, 124, 157-159, 164-165, 171, 174-186, 189-205, 213, 219, 229, 232, 234, 241, 246, 248, 254, 257-262, 299, 306-309, 317-319, 322-326, 333, 344-345, 349-359
papers/duplicate.py     384    136    65%   72-74, 88-89, 95-96, 100-101, 150-157, 163, 174, 176, 178, 195, 200-235, 242, 246, 272, 294, 304, 312, 314-318, 340, 349-371, 401-404, 407, 410, 417, 420, 427, 430-433, 436-451, 477-484, 487, 490, 493, 496-497, 500, 511-525, 538-542, 560-561, 619, 622
papers/encoding.py       84     22    74%   35, 63-64, 106-120, 125-128
papers/extract.py       236    151    36%   32, 51-78, 97, 105, 109, 117-118, 132, 144-159, 179-189, 193-199, 202, 215-221, 226-229, 234-239, 244-245, 250-268, 272, 277-286, 292-332, 337-367, 372-386
papers/filename.py       51      4    92%   18-19, 45-46
papers/latexenc.py       57     36    37%   23-31, 41-90, 100-101
---------------------------------------------------
TOTAL                  2080    833    60%
perrette commented 1 year ago

@boyanpenkov I think we are now in a better shape to work on the tests (split by thematics, coverage works). In case you wish to work on adding some, don't hesitate to write me in PM, or to say on which tests you want to work first, so that we don't cross PRs. I'll make a break for now. Current status:

Name                  Stmts   Miss  Cover   Missing
---------------------------------------------------
papers/__init__.py        4      0   100%
papers/__main__.py      526    191    64%   32, 81-89, 105-121, 125-135, 149-151, 154, 173, 179-180, 201-202, 205-206, 221-222, 241, 247-252, 255-262, 273, 308, 320-332, 335-341, 345-349, 358, 362-372, 376, 379, 383-388, 393-498, 501, 812-813, 823, 835, 837, 839, 841, 846-850
papers/_version.py        2      0   100%
papers/bib.py           492    196    60%   45-47, 67, 140-143, 157-158, 175-190, 214, 233-234, 237, 260-264, 273, 332, 371, 381, 388, 401-402, 408, 440-446, 450, 455-459, 469, 505, 513-514, 523, 541, 562-565, 575-580, 590-594, 598-613, 616-629, 633-660, 664-668, 671, 674-682, 686, 692-703, 709-781
papers/config.py        252     82    67%   35, 67-68, 95-99, 106, 111, 117-120, 125, 158-160, 165-166, 172, 175-187, 190-206, 214, 231, 234, 236, 248, 256, 259-264, 301, 308-311, 319-321, 324-328, 335, 346-347, 351-361
papers/duplicate.py     384    136    65%   72-74, 88-89, 95-96, 100-101, 150-157, 163, 174, 176, 178, 195, 200-235, 242, 246, 272, 294, 304, 312, 314-318, 340, 349-371, 401-404, 407, 410, 417, 420, 427, 430-433, 436-451, 477-484, 487, 490, 493, 496-497, 500, 511-525, 538-542, 560-561, 619, 622
papers/encoding.py       84     22    74%   35, 63-64, 106-120, 125-128
papers/extract.py       236    151    36%   32, 51-78, 97, 105, 109, 117-118, 132, 144-159, 179-189, 193-199, 202, 215-221, 226-229, 234-239, 244-245, 250-268, 272, 277-286, 292-332, 337-367, 372-386
papers/filename.py       51      4    92%   18-19, 45-46
papers/latexenc.py       57     36    37%   23-31, 41-90, 100-101
---------------------------------------------------
TOTAL                  2088    818    61%
boyanpenkov commented 1 year ago

OK, no problem; I'll keep this in mind.