[TIP] secondary testing tools

Éric Araujo merwok at netwok.org
Fri May 6 10:42:33 PDT 2011


 Le 06/05/2011 12:09, Jamu Kakar a écrit :
> On Fri, May 6, 2011 at 4:11 AM, Rustom Mody <rustompmody at gmail.com> 
> wrote:
>> For running a battery of tests (in good-ol C projects), the Makefile
>> is often used.
>> What is the recommended tool for orchestrating testing in python?

 There’s an emerging consensus about using “setup.py test”.  Such a 
 command is provided by setuptools, distutils2 (the new standard, which 
 will be included in Python 3.3. and released separately for 2.4-3.2), or 
 you can write one in ten lines if you want no dependency (I’ll post an 
 example on the Python Cookbook later).  The great thing about it is that 
 users don’t have to know what testing tools you use, they can just run 
 “setup.py test”.

> There are a number of ways to run unit tests in Python.  I like
> Twisted's trial runner a lot and usually have a Makefile with a check
> target, like:

 Why not “make test”?  Check, lint and test are different actions in my 
 mind: test runs the test suite, lint runs code checking tools, and check 
 verifies the packaging (it’s a distutils command provided in Python 2.7 
 and 3.x).


More information about the testing-in-python mailing list