[TIP] Test discovery for unittest

Olemis Lang olemis at gmail.com
Mon Apr 6 07:49:24 PDT 2009


On Fri, Apr 3, 2009 at 9:52 PM, Michael Foord <fuzzyman at voidspace.org.uk> wrote:
> Ned Batchelder wrote:
>> This sounds like what nose does.  Are you taking a different approach?
>
> Yes, I want to put it in unittest. :-)
>

Please, I would like to know something. In XUnit test discovery is
performed by test loaders. And that's according to the philosophy
behind that framework. I really dont understand why other frameworks
have been writing multiple plugin systems and complicated stuff since
all this was already there since a long time (perhaps needing
improvements, ok )

I mean this is the reason why I wrote MultiTestLoader and
PackageTestLoader classes in dutest. If you want to load multiple
types of tests from a single (module | file), provided that a loader
does nothing but loading the tests written using a single and
well-known style (e.g. unittest.TestCase & doctests ;) :

{{{
#!python

loader1 = dutest.DocTestLoader()
loader2 = unittest.TestLoader()
loader3 = TheBestLoaderEver()

l = MultiTestLoader(loader1, loader2, loader3)

l.loadTestsFromModule(mymodule)

}}}

Is there anything wrong with this ? ...

PS: I hate ellipsis ... XD

-- 
Regards,

Olemis.

Blog ES: http://simelo-es.blogspot.com/
Blog EN: http://simelo-en.blogspot.com/

Featured article:



More information about the testing-in-python mailing list