python / raspberryio

Source code for raspberry.io
http://raspberry.io
Other
221 stars 41 forks source link

Improve test coverage #191

Closed vkurup closed 11 years ago

vkurup commented 11 years ago

If acceptable, I think this closes #115 for now.

/cc @calebsmith

Final result is:

 Unit Test Code Coverage Results
----------------------------------------------------------------------
Name                             Stmts   Miss  Cover   Missing
--------------------------------------------------------------
raspberryio.aggregator               0      0   100%   
raspberryio.aggregator.forms        10      0   100%   
raspberryio.aggregator.models       97     45    54%   50, 55, 70-92, 109, 112, 116-152
raspberryio.aggregator.utils         3      0   100%   
raspberryio.aggregator.views        45     30    33%   15-16, 36-44, 54-67, 77-84, 94-98
raspberryio.project                  0      0   100%   
raspberryio.project.forms           68      0   100%   
raspberryio.project.models          98      0   100%   
raspberryio.project.utils           45      0   100%   
raspberryio.project.views          128      0   100%   
raspberryio.qanda                    0      0   100%   
raspberryio.qanda.forms             27      0   100%   
raspberryio.qanda.models            41      0   100%   
raspberryio.qanda.views             57      0   100%   
raspberryio.search                   0      0   100%   
raspberryio.search.models            8      0   100%   
raspberryio.search.utils            42     10    76%   44-46, 64-67, 70-72
raspberryio.search.views            33      0   100%   
raspberryio.userprofile              0      0   100%   
raspberryio.userprofile.forms        9      0   100%   
raspberryio.userprofile.models      18      0   100%   
raspberryio.userprofile.views       59      0   100%   
--------------------------------------------------------------
TOTAL                              788     85    89%   
----------------------------------------------------------------------
calebsmith commented 11 years ago

:shipit:

Nice work. The added tests LGTM. I'm not sure I completely follow the change here: https://github.com/python/raspberryio/commit/4e81430b349d11a74f8cdb8aff7bf9e75b3fa5d7 but I think you're right that the check is redundant.

IIRC, the search_models stuff is hard to unittest properly because of import time side-effects. This is entirely my own fault. I ran out of time making this work and didn't have time to troubleshoot making it bootstrap the search models properly without using gross side-effects. It is a definite code smell that would be nice to fix eventually but probably a bit out of scope for this.