[TIP] Invoking tests

Michael Foord fuzzyman at voidspace.org.uk
Sat Jul 24 11:28:19 PDT 2010


On 24/07/2010 18:31, Joseph Heck wrote:
> Is there a standard convention, or even a growing one, around where and how to invoke the tests associated with a project? In many projects, I'm seeing it bundled into a Make, a separate test.py script at the top level of the project, etc to do the work.
>
> I looked around for some common thing with setup.py, but didn't spot anything there (granted, I didn't look hard). What's common and best practice?
>    

Well, if you use unittest2 you can just use the unit2 test runner to run 
your tests:

unit2 discover

There *is* integration with the setuptools test command, but it isn't 
ideal as it uses unittest to run your unittest2 based tests (so things 
like test skips or expected failures aren't reported correctly).

You use this by putting "test_suite = 'unittest2.collector'" in your 
setup.py. One of the distutils guys (merwork) has contributed a 
distutils test command which I will evaluate soon (and distutils2 will 
have a test command built into it).

All the best,

Michael

> - joe
>    


-- 
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