[TIP] including tests in packages, or not

Robert Collins robertc at robertcollins.net
Sun Sep 20 19:56:07 PDT 2009


On Sun, 2009-09-13 at 19:35 -0700, C. Titus Brown wrote:

> -> or somesuch.  It helps tremendously to know what your test suite does
> -> on their machine, before starting to dig deeper.
> 
> Yep!
> 
> I plan to get it working with
> 
> 	python -m tagnabbit.tests
> 
> which seems nice and simply (especially if I can get it reporting back
> to my CI server, heh).

I ran into a little buglet with that in 2.6 the other day. 2.7 will be a
lot better because of the test loading/discovery work thats been done.

For 2.6 it would be great if loadTestsFromName supported callables -
then you can use the test_suite idiom to have:
   python -m tagnabbit.test_suite
work.
That would depend on a small thunk in the top namespace:

def test_suite():
    import unittest
    import tests
    return TestLoader.loadTestsFromNames(tests.test_suite)

(and turtles all the way down from there).

As for your CI server; if it speaks Pandokia or Subunit, you could just
toss the tests at an anonymous RPC.

For subunit that would be 
python -m subunit.run tagnabbit.test_suite | <something that pipes stdin
to your RPC>

-Rob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://lists.idyll.org/pipermail/testing-in-python/attachments/20090921/829f8980/attachment.pgp 


More information about the testing-in-python mailing list