[TIP] new discovery.py - q&a???

Doug Philips dgou at mac.com
Mon May 4 10:22:13 PDT 2009


On or about Monday, May 04, 2009, at 01:04PM, Michael Foord indited:
>I assume you mean:
>
>    In a *package* context, 'load_tests' is really a filtery kind of 
>thing where as in a module context it is only a filter by a stretch of 
>filtering nothingness into a sequence of tests. :)

Ok, so I am even more confused: (line numbers taken from: http://twurl.nl/nz8f4y)
Looking at _find_tests(), line 89 is testing for a file (module), and line 93 is yielding loadTestsFromModule.
On line 25 (in loadTestsFromModule) is calling the super class to do the loading and then passing the loaded tests into the modules 'load_tests' function (if it exists), and that is the use of 'load_tests' as a filter that I was referring to.
On line 115 is where the package's load_tests' function is used as a filter from nothing-ness to a test sequence. :)


>loader.discover(...) returns a test suite as normal and can be used in 
>any which way you please...

understood.

-Doug



More information about the testing-in-python mailing list