[TIP] Coverage.py 3.1 beta 1: Python 3.x and Cobertura output
markwaite at yahoo.com
Mon Sep 28 20:54:06 PDT 2009
I installed the most recent coverage.py on Windows Vista x64 with Hudson 1.325. It ran the coverage report and parse the output with the Cobertura plugin. My tests are quite simple (mostly tiny little unit tests, testing simple code on the other side as well).
I was already using nosetests for test discovery. That required a few changes to make it work (either inside or outside Hudson).
Before coverage, I ran the tests with the command:
After installing coverage, I ran the same tests with the command:
coverage run c:\Python26\Scripts\nosetests-script.py
With those commands, I'm able to see percentage coverage results. Unfortunately, the Cobertura plugin will not show me the source of the files. In the coverage.xml file, the file name is listed as "test_add_atom.py", while the full path to the source file is "tests\libpdm\test_add_atom.py". I have a suspicion that there is a way to tell the Cobertura plugin where to find my source files, but since this was the first time I'd ever used the Cobertura plugin for Hudson, I was glad to see it work at all.
Since I already have a script that performs repairs in nosetest.xml (the --with-xunit output file), I think I can easily extend that script to perform repairs in the coverage.xml file.
Thanks for a great tool!
From: Ned Batchelder <ned at nedbatchelder.com>
To: Sebastien Douche <sdouche at gmail.com>
Cc: tip <testing-in-python at lists.idyll.org>
Sent: Monday, September 28, 2009 7:13:01 AM
Subject: Re: [TIP] Coverage.py 3.1 beta 1: Python 3.x and Cobertura output
Sebastien Douche wrote:
On Sun, Sep 27, 2009 at 17:37, Ned Batchelder <ned at nedbatchelder.com> wrote:
>I'm especially interested in finding people using Hudson or Sonar with
>Is it possible to use Sonar with Python? As far I know, It's a "
>graphical frontend" for misc Java tools (code coverage, cc...). Btw,
>I'm also interested :).
Honestly, I don't know. That's my difficulty here: Cobertura is
integrated into a few Java toolsets, which I have no experience with,
and even trying to follow the tutorials takes me into unfamiliar
territory. Hudson and Sonar seem to be two that are popular. I'm
hoping this list has some knowledgeable practitioners who can help a
poor n00b like me...
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the testing-in-python