doctest, unittest, or if __name__='__main__'

Fredrik Lundh fredrik at pythonware.com
Wed Mar 29 02:33:50 EST 2006


Christoph Zwerschke wrote:

> > Is this 'consensus opinion' or mainly your own opinion?
>
> It is just a consequence from the fact that unittest is actually a port
> from JUnit (Java) to Python, i.e. a consequence of trying to emulate a
> standard framework that many programmers are already familiar with,
> which is essentially not a bad idea. However, if you try to counterfeit
> Java programming, your code won't be effective or elegant in Python.

comparing unittest to py.test (which is from the "almost too clever"
school of pythonic engineering) might be illustrative:

http://ianbicking.org/docs/pytest-presentation/pytest-slides.html

(see the "why not unittest" slide for a list of issues with unittest)

> > Is there a summary somewhere (in addition to the Zen of Python thingy)
> > of what kinds of things are 'pythonic' and why they are considered so?
> > I see it referred to a lot, and am starting to get a feel for it in
> > some areas but not others.
>
> It's probably never been listed completely (and it also changes slowly
> as the language evolves).

it cannot be defined, per definition.  a good approxmation is "pencil-like
qualities".

</F>






More information about the Python-list mailing list