<br><br><div class="gmail_quote">On Sat, Oct 16, 2010 at 1:12 PM, Ronny Pfannschmidt <span dir="ltr"><<a href="mailto:Ronny.Pfannschmidt@gmx.de">Ronny.Pfannschmidt@gmx.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5">On Sat, 2010-10-16 at 12:11 -0400, Alfredo Deza wrote:<br>
><br>
><br>
> On Fri, Oct 15, 2010 at 8:23 PM, Ronny Pfannschmidt<br>
> <<a href="mailto:Ronny.Pfannschmidt@gmx.de">Ronny.Pfannschmidt@gmx.de</a>> wrote:<br>
><br>
> On Sun, 2010-02-28 at 16:38 -0500, Alfredo Deza wrote:<br>
> > After Ned Batchelder's talk in Python I spent a few minutes<br>
> talking<br>
> > about how nice it is to have as much (or even more!) test<br>
> code lines<br>
> > than source code lines.<br>
> ><br>
> > I have put together a small script that will count the lines<br>
> of code<br>
> > in a given directory and will compare them to your test code<br>
> lines<br>
> > with a nice output (e.g. percentage, total lines, lines per<br>
> file<br>
> > etc...).<br>
> ><br>
> > Ideally, this could become a plugin for Nose (or py.test),<br>
> but for<br>
> > now, it will create an executable symlink so you can run it<br>
> anywhere.<br>
> ><br>
> > The project page: <a href="http://code.google.com/p/pygora/" target="_blank">http://code.google.com/p/pygora/</a><br>
> ><br>
> > I am using distribute to package Pygora, you can install it<br>
> by:<br>
> ><br>
> > sudo easy_install pygora<br>
> ><br>
> > And, if you were not wondering already, the name comes from<br>
> a *goat*:<br>
> > Pygora Goat is a cross between the Pygmy Goat and the Angora<br>
> Goat that<br>
> > produces three distinct kinds of fleece and has the smaller<br>
> size of<br>
> > the Pygmy.<br>
> > Source: Wikipedia<br>
> ><br>
> ><br>
> > Pygora could do better in telling what lines to count with a<br>
> nice<br>
> > regex, but this first release will get you an idea,<br>
> enhancements will<br>
> > follow.<br>
><br>
><br>
> you might want to take a look at py.countloc which is shipped<br>
> by py (and<br>
> will be in pycmd in future)<br>
><br>
> py.countloc provides way better numbers (imho)<br>
><br>
><br>
><br>
><br>
> Since I had py.test installed I tried out py.countloc, and I have a<br>
> few comments...<br>
><br>
><br>
> The idea behind pygora is to have a comparison ratio, to know where<br>
> your test line numbers<br>
> are related to those of your source code, this is not provided by<br>
> py.countloc<br>
><br>
><br>
> In the latest pygora version (you have actually replied to the first<br>
> announcement dated in February)<br>
</div></div>my misstake, i was in the middle of working trough the backlog of the<br>
ml, and mindlessly replied to the first mail instead of finding the<br>
latest one<br></blockquote><div><br></div><div>no big deal :)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">> speed was improved a lot, and in fact after benchmarking both tools<br>
> pygora takes almost<br>
> half the time to go through a path and get the metrics.<br>
><br>
><br>
> For example, in a directory with around 1,5 million lines of code<br>
> these are the times I got (best out of 3 runs):<br>
><br>
><br>
> py.countloc 4.04s user 0.50s system 99% cpu 4.572 total<br>
><br>
><br>
> pygora 2.52s user 0.66s system 97% cpu 3.253 total<br>
</div>interesting timings, i think py.countloc was only optimized for accurate<br>
numbers, not raw speed, i'll take a look at that once my todo is shorted<br>
out<br></blockquote><div><br></div><div>Well, I think the speed improvements are a by-product of refactoring the previous version.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">><br>
><br>
> There is also no way to tell py.countloc to avoid printing *every*<br>
> single file it is counting. This is specially<br>
> annoying for 1.5m lines of code, also, no way of filtering or<br>
> excluding certain files.<br>
><br>
><br>
> All of those options are available with pygora (e.g. verbose option,<br>
> filtering etc...) although implementing<br>
> them in py.countloc shouldn't be a hard thing to do.<br>
><br>
><br>
> Having said that, I find that the source line detection in py.countloc<br>
> seems a bit more accurate. I initially had<br>
> trouble in deciding for example if docstrings should count as part of<br>
> the source code or not (I ended including them).<br>
</div>thats why i wanted to point you at it after trying a easy_installed<br>
pygora<br>
<div class="im">><br>
><br>
> In my specific case, I like something fast that reports what I need.<br>
> If I want a ratio to be able to compare, this output<br>
> seems too much for me:<br>
><br>
><br>
> number of testfiles 794<br>
> number of non-empty testlines 158805<br>
> number of files 6906<br>
> number of non-empty lines 1342471<br>
><br>
><br>
> Compared to:<br>
><br>
><br>
> Test lines = 214669<br>
> Source lines = 1241449<br>
> Total lines = 1456118<br>
><br>
><br>
> Your test code is 17.29% of your source code<br>
><br>
</div>i guess i'm more interested in the other stats,<br>
usually the ratio of test lines vs tested code lines<br>
isn't that interesting (i tend to have more test lines than code lines)<br>
whats more interesting to me is the ratio of code/branch coverage<br></blockquote><div><br></div><div>you mention "ratio" but I just don't see any ratio with py.countloc, unless</div><div>I am missing something...</div>
<div><br></div><div>I'm also confused here about "code/branch coverage". What do you mean? this is *not* </div><div>a coverage tool, it just counts lines and compares them. </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5"><br>
><br>
><br>
> ><br>
> ><br>
> > Thanks for an awesome an inspiring talk Ned!<br>
> ><br>
> ><br>
> ><br>
> ><br>
> > --<br>
> > Alfredo Deza<br>
> ><br>
><br>
> > _______________________________________________<br>
> > testing-in-python mailing list<br>
> > <a href="mailto:testing-in-python@lists.idyll.org">testing-in-python@lists.idyll.org</a><br>
> > <a href="http://lists.idyll.org/listinfo/testing-in-python" target="_blank">http://lists.idyll.org/listinfo/testing-in-python</a><br>
><br>
><br>
<br>
</div></div></blockquote></div><br>