[TIP] Getting py.test to output xcoverage/cobertura format data (and play nice with Hudson)

Alfredo Deza alfredodeza at gmail.com
Wed Feb 16 10:36:33 PST 2011


On Wed, Feb 16, 2011 at 1:24 PM, Alfredo Deza <alfredodeza at gmail.com> wrote:

>
>
> On Wed, Feb 16, 2011 at 12:39 PM, holger krekel <holger at merlinux.eu>wrote:
>
>> On Wed, Feb 16, 2011 at 10:14 -0700, Chris Rose wrote:
>> > I'd like to try out py.test; I've found that it's nicer output-wise than
>> nose in a lot of respects. However, we have a significant in-house
>> investment in Hudson/Jenkins automated testing that currently depends on
>> nose + xcoverage + xunit output to tie into the Hudson xUnit/Cobertura
>> plugin support for tracking test coverage and successes.
>> >
>> > Is there a clear process for tying these things together? I see the
>> --junitxml output flag, so that's part of the issue solved, but it doesn't
>> handle coverage.
>>
>> This is how I call py.test in Jenkins:
>
> py.test -v --junitxml junit.xml --cov-report xml --cov my_project
>
> You need to enable the "Cobertura" plugin to be able to catch the xml from
> pytest-cov
>
> And that should do it.
>

Errr... just checked and I am missing some stuff that you need for this to
work:

In post-build-actions:

* Check "Publish JUnit test suite result report"
* Test reports XMLs should have: "junit.xml"
* Check "Publish Cobertura Coverage Report"
* Cobertura xml report pattern should say: "coverage.xml"
* Coverage Metric Targets is set to Methods


Now *that* should do it :)

>
>
> I am not aware of a pytest plugin that outputs coverage info parseable by
>> Jenkins.  There is only "pytest-cov" which provides coverage output in
>> html or text pages.  Not sure how hard it is to extend it or if anybody
>> tried yet.
>>
>> best,
>> holger
>>
>> > --
>> > Chris
>> > Not to be taken literally, internally, or seriously.
>>
>> > _______________________________________________
>> > testing-in-python mailing list
>> > testing-in-python at lists.idyll.org
>> > http://lists.idyll.org/listinfo/testing-in-python
>>
>>
>> --
>>
>> _______________________________________________
>> testing-in-python mailing list
>> testing-in-python at lists.idyll.org
>> http://lists.idyll.org/listinfo/testing-in-python
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.idyll.org/pipermail/testing-in-python/attachments/20110216/2cd02144/attachment.htm>


More information about the testing-in-python mailing list