[TIP] Test discovery for unittest

Robert Collins robertc at robertcollins.net
Mon Apr 6 20:38:39 PDT 2009


On Tue, 2009-04-07 at 04:01 +0100, Michael Foord wrote:

> But a technique based on this patch won't support the 'abort recursing 
> into packages if load_test' is found behavior - at least not as is.
> 
> I'm fine with having load_test called from inside the loader, as 
> presumably this matches your general use case even without test 
> discovery, but discovery has to know whether load_test was found (or 
> maybe it can tell just from a hasattr on the module?).

It could tell from a hasattr, or you could even do the discovery patch
as a change to TestLoader  - e.g. loadTestsFromPaths(self, paths,
include_pattern, exclude_pattern, ..). 

Oh, I remembered another of the reasons why I included 'module' in my
signature for load_tests in bzr; if you look at loadTestsFromModule in
TestLoader, when it calls load_tests, it has a module object there which
it has used for introspection; it just seemed natural to hand it down to
the hook. [I'm still fine with not having it in the signature Python
adopts].

-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/20090407/1ea6c5c8/attachment.pgp 


More information about the testing-in-python mailing list