[TIP] impossible coverage results - django, django-nose, nose-cov, coverage

Chris Withers chris at simplistix.co.uk
Tue Jan 19 02:11:24 PST 2016


On 19/01/2016 02:32, Ned Batchelder wrote:
>> After some changes to unwind some knotty import loops in a big Django
>> project, we're now seeing coverage report seemingly impossible
>> results: looking at one module, I see coverage has dropped from 80+%
>> to 27%, with the lines-no-longer-covered being those that would have
>> had to execute during import time.
>
> A common problem with the django-nose-cov plugin ecosystem is that
> coverage doesn't start until after many modules are already imported.  I
> usually recommend that coverage run the test runner, instead of the
> other way around.  This ensures that coverage measures everything.

Yep, that did it.

Many thanks, beer owed at PyCon!

Chris



More information about the testing-in-python mailing list