<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
I've finally checked in a fix for this problem. It's a long story, and
I can share the details if you really want, but it boils down to a
module that TurboGears uses called DecoratorTools. This module is too
clever by half, and ends up trashing the trace function that coverage
needs to measure the code. <br>
<br>
The fix involves a new mode for coverage.py, enabled with the --timid
switch, which makes coverage use a simpler and slower trace function.
This trace function isn't clobbered by DecoratorTools, so the code is
properly measured. For use with nosetests, you can set an environment
variable COVERAGE_OPTIONS to --timid also.<br>
<br>
I haven't cut a new release yet, but you can use the tip of coverage.py
(<a class="moz-txt-link-freetext" href="http://bitbucket.org/ned/coveragepy/downloads/">http://bitbucket.org/ned/coveragepy/downloads/</a>) for now.<br>
<br>
--Ned.<br>
<a class="moz-txt-link-freetext" href="http://nedbatchelder.com">http://nedbatchelder.com</a><br>
<br>
Doug Latornell wrote:
<blockquote
cite="mid:6279c0a40907160945t4f40b57as48ffab659bf7972c@mail.gmail.com"
type="cite"><font face="times new roman,serif">Thanks for the
suggestions, Ned. I confirmed that the problem exists in a minimal TG
1.0.5 project:<br>
<br>
</font>
<div style="margin-left: 40px;"><font face="courier new,monospace">alec:coverage-test$
tg-admin quickstart spam</font><br>
<font face="courier new,monospace">...</font><br>
<font face="courier new,monospace">alec:coverage-test$ cd spam/</font><br>
<font face="courier new,monospace">alec:spam$ nosetests
--with-coverage --cover-package=spam --cover-erase</font><br>
<font face="courier new,monospace">..</font><br>
<font face="courier new,monospace">Name Stmts Exec
Cover Missing</font><br>
<font face="courier new,monospace">------------------------------------------------</font><br>
<font face="courier new,monospace">spam 1 1
100%</font><br>
<font face="courier new,monospace">spam.config 1 1
100%</font><br>
<font face="courier new,monospace">spam.controllers 7
0 0% 1-13</font><br>
<font face="courier new,monospace">spam.templates 1 1
100%</font><br>
<font face="courier new,monospace">------------------------------------------------</font><br>
<font face="courier new,monospace">TOTAL 10 3
30%</font><br>
<font face="courier new,monospace">----------------------------------------------------------------------</font><br>
<font face="courier new,monospace">Ran 2 tests in 1.492s<br>
<br>
OK<br>
alec:spam$ sudo easy_install "coverage==2.85"<br>
...<br>
alec:spam$ nosetests --with-coverage --cover-package=spam --cover-erase<br>
..<br>
Name Stmts Exec Cover Missing<br>
------------------------------------------------<br>
spam 0 0 100%<br>
spam.config 0 0 100%<br>
spam.controllers 7 7 100%<br>
spam.templates 0 0 100%<br>
------------------------------------------------<br>
TOTAL 7 7 100%<br>
----------------------------------------------------------------------<br>
Ran 2 tests in 9.206s<br>
<br>
OK<br>
</font><br>
</div>
<font face="courier new,monospace"><span
style="font-family: times new roman,serif;">Next, I'll try your -L
option suggestion, and the logging from tip.</span><br
style="font-family: times new roman,serif;">
<br style="font-family: times new roman,serif;">
<span style="font-family: times new roman,serif;">Re: -L is there a
way to pass a switch to coverage through the nose plug-in? AFAIK, the
TG quickstart project template relies on nose for test discovery. The
test module has nothing like a unittest.main() interface.</span><br
style="font-family: times new roman,serif;">
<br style="font-family: times new roman,serif;">
<span style="font-family: times new roman,serif;">Doug</span><br>
</font><br>
<br>
<div class="gmail_quote">On Wed, Jul 15, 2009 at 6:34 PM, Ned
Batchelder <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:ned@nedbatchelder.com">ned@nedbatchelder.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote"
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div bgcolor="#ffffff" text="#000000">
Doug, thanks for reporting this. If you don't get a toy TG project
working, here are two things to try:</div>
</blockquote>
<div bgcolor="#ffffff" text="#000000"> <br>
...</div>
<div> </div>
<blockquote class="gmail_quote"
style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div bgcolor="#ffffff" text="#000000"><br>
--Ned.<br>
<a moz-do-not-send="true" href="http://nedbatchelder.com"
target="_blank">http://nedbatchelder.com</a></div>
</blockquote>
</div>
<br>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Ned Batchelder, <a class="moz-txt-link-freetext" href="http://nedbatchelder.com">http://nedbatchelder.com</a>
</pre>
</body>
</html>