[TIP] Test discovery for unittest
marius at gedmin.as
Wed Apr 8 11:34:09 PDT 2009
On Tue, Apr 07, 2009 at 06:04:42PM +0100, Michael Foord wrote:
> Marius Gedminas wrote:
> > I don't think I can give this discussion the full attention it deserves,
> > but I'll at least outline the conventions that the Zope 3 world uses for
> > tests:
> > Is this compatible with what you're discussing? I'm kind of wondering
> > about the talk about controlling recursion.
> It sounds *similar*, except:
> - Test modules can be discovered from the file system by a loader /
> custom suite
> - Tests are loaded in the normal unittest way - by finding all TestCase
> subclasses in each module found
Zope 3 has some abstract base classes that subclass unittest.TestCase.
I believe that's the reason for listing the ones you want explicitly
instead of using unittest's autodiscovery.
> - Individual modules can optionally define 'load_tests' in which case
> that is called to get the suite from the module
And the presence of load_tests inhibits the automatic discovery of
> - If a package (in the __init__.py) defines 'load_tests' then that is
> used to load the suite for the whole package and discovery does not
> continue into the package directory (this is the 'controlling recursion'
> I disagree that failing to load modules should not be a fatal error by
> default. If a test system wants that behavior it can implement it itself
> in load_tests.
Your views are interesting ;)
The reason computer chips are so small is that computers don't eat much.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 189 bytes
Desc: Digital signature
Url : http://lists.idyll.org/pipermail/testing-in-python/attachments/20090408/356ed323/attachment.pgp
More information about the testing-in-python