[Zope-dev] [PATCH] subunit output for zope.testing

Marius Gedminas marius at gedmin.as
Fri Mar 12 09:09:16 EST 2010


On Thu, Mar 11, 2010 at 10:38:15PM +0000, Jonathan Lange wrote:
> On Thu, Mar 11, 2010 at 9:17 PM, Marius Gedminas <marius at gedmin.as> wrote:
> > Incidentally, how do you integrate it with Hudson?  subunit2junitxml, I
> > assume?  How exactly do you combine bin/test with subunit2junitxml -- I
> > assume some care with respect to exit codes?
> 
> I haven't tried myself, but from analogy with other subunit tools:
>   ./bin/test --subunit | subunit2junitxml

Ah, nice.  I was afraid that a naive attempt of something like

  bin/test --subunit > result.subunit
  subunit2junitxml result.subunit -o result.xml

would break because Hudson runs the build step as a shell script with sh
-e and therefore bin/test returning a non-zero exit code would abort the
script without running subunit2junitxml.  But a pipeline ignores the
exit code of all but the very last process.

Incidentally, does subunit2junitxml return a non-zero exit code when
there are failing tests?

I tried to easy_install subunit to experiment, but apparently subunit is
not registered on PyPI (!?)

> The formatter doesn't control exit codes, so I didn't really think
> about them in this patch. Should I produce a follow up?

It's not really in scope for this patch, but given the rising popularity
of Hudson I think it would be nice to have a small README.hudson in
zope.testing explaining the integration.

> > On Thu, Mar 11, 2010 at 08:52:11PM +0000, Jonathan Lange wrote:
> >> === modified file 'src/zope/testing/testrunner/testrunner-leaks.txt'
> >> --- src/zope/testing/testrunner/testrunner-leaks.txt  2008-05-05 18:50:48 +0000
> >> +++ src/zope/testing/testrunner/testrunner-leaks.txt  2010-02-20 22:23:32 +0000
> >> @@ -16,7 +16,7 @@
> >>      >>> from zope.testing import testrunner
> >>
> >>      >>> sys.argv = 'test --layer Layer11$ --layer Layer12$ -N4 -r'.split()
> >> -    >>> _ = testrunner.run(defaults)
> >> +    >>> _ = testrunner.run_internal(defaults)
> >
> > I'm curious about this change.
> 
> Sidnei explained it correctly. This particular file is only tested if
> you're running a Python with --with-pydebug set, so it's easy to miss
> when you make a change.

Ah!  That explains why it wasn't fixed on trunk.

(This bit should probably be committed separately.  And zope.testing
could use a bit more continuous integration with various Python
versions/build flags...)

Marius Gedminas
-- 
http://pov.lt/ -- Zope 3 consulting and development
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
Url : http://mail.zope.org/pipermail/zope-dev/attachments/20100312/52178412/attachment.bin 


More information about the Zope-Dev mailing list