[TIP] After upgrade to coverage 3.0.1, nosetests --with-coverage shows zero lines covered!

Ned Batchelder ned at nedbatchelder.com
Wed Jul 15 18:34:57 PDT 2009


Doug, thanks for reporting this.  If you don't get a toy TG project 
working, here are two things to try:

1) Try running coverage with the -L switch to include tracing the std 
lib.  This is just to see if the stdlib-exclusion code is at fault.

2) If you can pull the latest code from bitbucket 
(http://bitbucket.org/ned/coveragepy/get/tip.gz), there's commented-out 
logging of the decision of what to trace and what not to. At line 123 of 
control.py is an "if 0:".  Change it to "if 1:", then run coverage.  
You'll get a line for each source file considered, showing the decision 
of whether to trace it or not.  If you don't mind showing the filenames 
of your code, that log could be helpful in understanding what's going on 
here.

--Ned.
http://nedbatchelder.com

Doug Latornell wrote:
> I'm having a similar problem running coverage 3.0.1 on a Turbogears 
> 1.05 project.
>
> Initially I had nose 0.10.3 and coverage 3.0.1 and got a coverage 
> report like this:
>
> Name                    Stmts   Exec  Cover   Missing
> -----------------------------------------------------
> zemiva                      1      1   100%
> zemiva.config               1      1   100%
> zemiva.controllers        409      0     0%   38-853
> zemiva.graphs             353      0     0%   13-527
> zemiva.init_database       91      0     0%   10-274
> zemiva.logs                23      0     0%   9-55
> zemiva.model              298      0     0%   2-794
> zemiva.release              7      0     0%   2-41
> zemiva.scheduled_jobs     259      0     0%   9-555
> zemiva.templates            1      1   100%
> zemiva.utils               38      0     0%   15-80
> zemiva.widgets             99      0     0%   2-308
> -----------------------------------------------------
> TOTAL                    1580      3     0%
> ----------------------------------------------------------------------
> Ran 109 tests in 85.575s
>
> Upgraded nose to 0.11.1 and got the same result.  Downgraded coverage 
> to 2.85 and got:
>
> Name                    Stmts   Exec  Cover   Missing
> -----------------------------------------------------
> zemiva                      0      0   100%
> zemiva.config               0      0   100%
> zemiva.controllers        378    260    68%   81, 93-94, 112-125, 
> 137-166, 222, 258-306, 369, 374-375, 497-512, 535-553, 662-665, 
> 685-709, 789
> zemiva.graphs             353    296    83%   38-40, 42-44, 46-48, 
> 51-53, 59-86, 129-131, 145-147, 215-217, 292-294, 302-304, 312-314, 
> 322-324, 332-334, 443-445, 447, 460-462, 477-479
> zemiva.init_database       91     86    94%   267-274
> zemiva.logs                23     23   100%
> zemiva.model              297    287    96%   99-102, 113, 443-444, 
> 448-449, 546
> zemiva.release              6      6   100%
> zemiva.scheduled_jobs     259     75    28%   66-225, 235-261, 
> 269-272, 279-281, 288-394, 402-429, 538-555
> zemiva.templates            0      0   100%
> zemiva.utils               38     28    73%   41-49, 59, 62-67
> zemiva.widgets             98     95    96%   119, 131, 189
> -----------------------------------------------------
> TOTAL                    1543   1156    74%
> ----------------------------------------------------------------------
> Ran 109 tests in 470.762s
>
> I created at toy project and got a sane result with nose 0.11.1 and 
> coverage 3.0.1:
>
> Name      Stmts   Exec  Cover   Missing
> ---------------------------------------
> bar           1      1   100%
> bar.baz       4      3    75%   6
> foo           3      3   100%
> ---------------------------------------
> TOTAL         8      7    87%
> ----------------------------------------------------------------------
> Ran 2 tests in 0.020s
>
> So, it looks like the problem arises from something the in the 
> Turbogears project, not coverage or nose+coverage.  I'll try to create 
> a toy TG project to see if I can reproduce the problem there.
>
> Any suggestions are welcome.
>
> Doug
>
> On Thu, Jul 9, 2009 at 2:02 PM, Ned Batchelder <ned at nedbatchelder.com 
> <mailto:ned at nedbatchelder.com>> wrote:
> >
> > Oh, and if this is the stackoverflow question you meant:
> > 
> http://stackoverflow.com/questions/931248/coverage-not-showing-executed-lines-in-virtualenv
> > , that problem was fixed in 3.0.  Maybe there's more to it than I 
> know...
> >
> > --Ned.
> > http://nedbatchelder.com
> >
> > Matthew Wilson wrote:
> > > I just upgraded to the 3.0.1 version of coverage.  Then I ran this
> > > command to test some of my code:
> > >
> > > $ nosetests --with-coverage --cover-package bazman.shiftcontrollers
> > > bazman/tests/controller_tests/test_shifttemplatecontrollers.py
> > >
> > > And the output showed ZERO lines covered.  So then I found a comment
> > > at stackoverflow saying that somebody went back to the old version,
> > > and all was well.  So I did that, and sure enough, I saw my coverage
> > > again.
> > >
> > > I'll happily provide more details.
> > >
> > > Matt
> > >
> > >
> > >
> > >
> >
> > --
> > Ned Batchelder, http://nedbatchelder.com
> >
> >
> >
> > _______________________________________________
> > testing-in-python mailing list
> > testing-in-python at lists.idyll.org 
> <mailto:testing-in-python at lists.idyll.org>
> > http://lists.idyll.org/listinfo/testing-in-python
>

-- 
Ned Batchelder, http://nedbatchelder.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.idyll.org/pipermail/testing-in-python/attachments/20090715/5866c016/attachment-0001.htm 


More information about the testing-in-python mailing list