[TIP] Guidelines for where to put tests & how to package them

Michael Foord fuzzyman at voidspace.org.uk
Fri Feb 26 12:46:38 PST 2010


On 26/02/2010 20:41, Robert Collins wrote:
> On Fri, 2010-02-26 at 18:29 +0000, Michael Foord wrote:
>    
>> Well - the techniques you discuss below work for unittest based tests,
>> will they automatically work for doctest tests?
>>      
> Yes
>
>    
>>   What about other test frameworks?
>>      
> If it exports a unittest test collection, yes.
>
>    
>> The advantage of having a run module that collects and runs the tests
>> is that it is agnostic of which test runner is used (or at least
>> allows the *user* to be agnostic, so long as they have the right
>> dependencies installed anyway).
>>      
> Except they need to know command line options to get JUnit xml out (or
> whatever the particular CI tool needs).
>
> The point of the load_tests hook + discover is that with them you have
> complete control over collection, regardless of test executor being
> chosen: as long as the test executor obeys the protocol.
>
> I think a similar thing should apply here.
>    

So the real requirement is that the package / module specified should 
either be a standard unittest package - or provide a load_tests function 
that returns a unittest compatible TestSuite-like object, capable of 
being run with a TextTestRunner.

If all test frameworks can adhere to this then I'm fine with dropping 
the 'run' module requirement.

Michael
> -Rob
>    


-- 
http://www.ironpythoninaction.com/
http://www.voidspace.org.uk/blog

READ CAREFULLY. By accepting and reading this email you agree, on behalf of your employer, to release me from all obligations and waivers arising from any and all NON-NEGOTIATED agreements, licenses, terms-of-service, shrinkwrap, clickwrap, browsewrap, confidentiality, non-disclosure, non-compete and acceptable use policies (”BOGUS AGREEMENTS”) that I have entered into with your employer, its partners, licensors, agents and assigns, in perpetuity, without prejudice to my ongoing rights and privileges. You further represent that you have the authority to release me from any BOGUS AGREEMENTS on behalf of your employer.





More information about the testing-in-python mailing list