doctest, unittest, or if __name__='__main__'

Roy Smith roy at panix.com
Tue Mar 28 07:06:30 EST 2006


In article <7xpsk7ch59.fsf at ruckus.brouhaha.com>,
 Paul Rubin <http://phr.cx@NOSPAM.invalid> wrote:

> "lollipopenator at gmail.com" <lollipopenator at gmail.com> writes:
> >  I have noticed some distinctly funny and confused feelings I get when
> > using the unittest module, stuff that feels clunky and odd about how it
> > is set-up, however I thought that this was just  due to *my personal*
> > lack of understanding of the deep magic and sophisticated design
> > patterns used in this module!
> > 
> > If it turns out to be 'unpythonic' 
> 
> The unpythonicness stems from it being basically a reimplementation of
> JUnit, which was designed for use with Java.

JUnit, in turn, is based on a package first implemented in SmallTalk 
(http://www.xprogramming.com/testfram.htm).

On stuff like this, I'm not opposed to things being slightly unpythonic.  
PyUnit does have some clunkyness to it, but there is some value in having 
all the unit test frameworks have a similar feel across languages.  
Unfortunately, it has become fashionable to call any sort of unit test 
framework "xxxUnit", whether or not it resembles the original or not.



More information about the Python-list mailing list