[TIP] Defining a convention for running tests, #2

Michael Foord fuzzyman at voidspace.org.uk
Sat Feb 27 12:41:55 PST 2010


On 27/02/2010 20:33, Robert Collins wrote:
> On Sat, 2010-02-27 at 20:18 +0000, Michael Foord wrote:
>
>
>    
>> My *understanding* (and apparently confirmed by Philipp Eby's
>> response) is that test_suite in setuptools specifies a suite and not a
>> callable.
>>      
> That surprises me. Here's what the nose folk think it does:
> "Setuptools has a feature that allows you to run the tests in a
> distribution by invoking the distribution's "setup.py" script with a
> "test" argument. As long as the argument's to "setup" within that script
> contains a "test_suite" parameter which resolves to a module, a package,
> or a function which returns a unittest TestSuite, it will invoke a
> unittest TestLoader subclass to find the tests within the distribution;
> it will then subsquently run them. For instance:"
> [http://plope.com/Members/chrism/nose_setup_py_test]
>
> This thread from a couple years back is interesting
> http://www.mail-archive.com/distutils-sig@python.org/msg02732.html
>
> http://ericholscher.com/blog/2009/jun/29/enable-setuppy-test-your-django-apps/ also thinks that test_suite in setup() can be the name of a callable to return the suite.
>    
The actual documentation for setuptools agrees with you:

http://peak.telecommunity.com/DevCenter/setuptools#test-build-package-and-run-a-unittest-suite

Odd, not what Phillip said. So setuptools (and therefore distribute) 
does currently support specifying test_suite as a callable that takes no 
args and returns a TestSuite. Given that we now have load_tests I'm 
unlikely to want to support that convention in the distutils2 "setup.py 
test" command but I'll talk to Tarek about it.

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