- Package:
- qa.debian.org
- Source:
- qa.debian.org
- Submitter:
- Stefano Zacchiroli
- Date:
- 2015-04-03 17:06:09 UTC
- Severity:
- wishlist
Debsources' test coverage is decent: /srv/debsources$ nosetests --with-coverage debsources/ -v --cover-package=debsources [...] /srv/debsources$ python-coverage report Name Stmts Miss Cover ------------------------------------------------------------------- debsources/__init__ 2 0 100% debsources/app/__init__ 2 0 100% debsources/app/app_factory 40 3 93% debsources/app/extract_stats 9 0 100% debsources/app/forms 5 0 100% debsources/app/infobox 54 11 80% debsources/app/pagination 20 1 95% debsources/app/sourcecode 71 32 55% debsources/app/views 342 67 80% debsources/archiver 104 22 79% debsources/charts 42 30 29% debsources/consts 9 0 100% debsources/dbutils 51 1 98% debsources/debmirror 128 34 73% debsources/excepts 16 0 100% debsources/filetype 58 23 60% debsources/fs_storage 68 20 71% debsources/hashutil 20 8 60% debsources/local_info 17 3 82% debsources/mainlib 145 77 47% debsources/models 328 25 92% debsources/plugins/__init__ 0 0 100% debsources/plugins/hook_checksums 73 7 90% debsources/plugins/hook_ctags 99 14 86% debsources/plugins/hook_hello 10 10 0% debsources/plugins/hook_metrics 51 0 100% debsources/plugins/hook_sloccount 70 7 90% debsources/sqla_session 8 0 100% debsources/statistics 157 35 78% debsources/subprocess_workaround 3 1 67% debsources/tests/__init__ 0 0 100% debsources/tests/db_testing 43 4 91% debsources/tests/test_archiver 118 0 100% debsources/tests/test_stats 71 0 100% debsources/tests/test_updater 164 8 95% debsources/tests/test_webapp 153 1 99% debsources/tests/testdata 4 0 100% debsources/tests/updater_testing 6 0 100% debsources/updater 318 69 78% ------------------------------------------------------------------- TOTAL 2879 513 82% But still short of 100%, which is required to give some basic guarantees of code well-formedness. Please increase (and/or maximize to 100%) Debsources' test coverage. FWIW, the first command shown above will give hints of the lines of code which are currently not exercised by the test suite. Patches that add new tests touching those lines are more than welcome. Cheers.
Attached is a patch adding tests for debsources.filetype. They were all
created from Matthieu's assertions in __main__.
I'm not sure whether I was right to create a new file and a new attribute
('filetype') for these tests; I'll amend the commit according to your
comments.
filetype.py's coverage went from 80% to 96%.
The patch is also available here:
https://github.com/clemux/debsources/commit/a946736342b945da393216879f5b27a2baa499ca
Thanks, this change is welcome: we'd like to have all tests under debsources/tests/, and if there are still tests under __main__ they should be moved there. I've applied your patch, modulo some changes to the license/copyright header, whose style has been improved concurrently with your patch. Cheers.
Attached is a patch adding tests for debsources.fs_storage, whose coverage is now 95% (formerly 70%), as well as a patch adding tests for debsources.hashutil, whose coverage is now 100% (formerly 71%). It might be a good idea to set the attribute of test_filetype, test_fs_storage and test_hashutil to 'utils' instead of a separate attribute for each of the test sets.
Thanks, I've merged and pushed both your patches --- with only minor changes: correct copyright year in the header and commit message style, for consistency with the Git history. (Have a look at the interdiff.) I don't understand what do you mean with this. But if you think it's relevant enough (I guess I don't), feel free to send a separate patch about this. Cheers.