Re: [Twisted-Python] Coverage summary with trial

2012-04-14 Thread Johan Rydberg
coverage.py is great

but we also use this: https://github.com/jrydberg/txcovreport

Sent from my iPhone

On 14 apr 2012, at 06:22, Duncan McGreggor duncan.mcgreg...@gmail.com wrote:

 On Fri, Apr 13, 2012 at 3:19 PM, Itamar Turner-Trauring
 ita...@itamarst.org wrote:
 Hi all,
 
 I would like to collect coverage statistic for my twisted code with trial
 and
 was wondering how to achieve this.
 
 I run something like:
   $ trial --coverage testdir/*_test.py
 
 coverage.py is  a much nicer tool: http://nedbatchelder.com/code/coverage/
 
 You'd do coverage.py [some arguments here] /path/to/trial mypackage,
 more or less.
 
 For example:
 
 $ sudo pip-2.7 install coverage
 $ cd ~/lab/txaws/trunk
 $ coverage run `which trial` ./txaws
 $ coverage report
 
 d
 
 ___
 Twisted-Python mailing list
 Twisted-Python@twistedmatrix.com
 http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Coverage summary with trial

2012-04-14 Thread Øystein S. Haaland
 On Fri, Apr 13, 2012 at 3:19 PM, Itamar Turner-Trauring
 
 ita...@itamarst.org wrote:
  Hi all,
  
  I would like to collect coverage statistic for my twisted code with
  trial and
  was wondering how to achieve this.
  
  I run something like:
$ trial --coverage testdir/*_test.py
  
  coverage.py is  a much nicer tool:
  http://nedbatchelder.com/code/coverage/
  
  You'd do coverage.py [some arguments here] /path/to/trial mypackage,
  more or less.
 
 For example:
 
  $ sudo pip-2.7 install coverage
  $ cd ~/lab/txaws/trunk
  $ coverage run `which trial` ./txaws
  $ coverage report
 

Thanks for your answers.

I had already tried coverage this way, but it produced no output for me. After 
investigating it further, it turns out that the wrapper script gentoo 
generates for /usr/bin/trial was at fault. Using /usr/bin/trial-2.7 instead 
worked fine.

---

Øystein

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


[Twisted-Python] Coverage summary with trial

2012-04-13 Thread Øystein S . Haaland
Hi all,

I would like to collect coverage statistic for my twisted code with trial and 
was wondering how to achieve this.

I run something like:
$ trial --coverage testdir/*_test.py

all tests are green and i can see coverage files in _trial_temp/coverage/.

After looking around a bit i learn that the python trace module is used under 
the hood and my assumption then is that i must use similar commands as those 
that are shown here:

http://docs.python.org/library/trace.html

I had to look at the source code to find this out. It would be nice if it was 
mentioned in the documentation somewhere.

So i try to construct a command like this:

python -m trace --summary --report --coverdir _trial_temp/coverage/

But it needs --file which seems not to be enabled by trial. I then make some 
changes in the trial script:


--- trial.py.orig   2012-03-30 06:32:08.627758872 +0200
+++ trial.py2012-04-14 04:50:05.416382063 +0200
@@ -162,7 +162,8 @@
 directory specified by the I{trial-temp} option.
 
 import trace
-self.tracer = trace.Trace(count=1, trace=0)
+   countfile=countfile.txt
+self.tracer = trace.Trace(count=1, trace=0, infile=countfile, 
outfile=countfile)
 sys.settrace(self.tracer.globaltrace)

and i can finally see a summary if i remember to add the --missing option:

python -m trace --report --summary --missing --file countfile.txt --
coverdir=_trial_temp/coverage/

I assume i am missing something obvious, because it seems strange that one 
would have to change the trial script to achieve this. How do other people 
create such summaries?

---

Øystein

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python


Re: [Twisted-Python] Coverage summary with trial

2012-04-13 Thread Duncan McGreggor
On Fri, Apr 13, 2012 at 3:19 PM, Itamar Turner-Trauring
ita...@itamarst.org wrote:
 Hi all,

 I would like to collect coverage statistic for my twisted code with trial
 and
 was wondering how to achieve this.

 I run something like:
       $ trial --coverage testdir/*_test.py

 coverage.py is  a much nicer tool: http://nedbatchelder.com/code/coverage/

 You'd do coverage.py [some arguments here] /path/to/trial mypackage,
 more or less.

For example:

 $ sudo pip-2.7 install coverage
 $ cd ~/lab/txaws/trunk
 $ coverage run `which trial` ./txaws
 $ coverage report

d

___
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python